TaskList<T> taskList = null;
// Get or create the task list with the {@link ClassContext}
ClassContext classContext = classContextInstance.get();
if (classContext.isActive()) {
ObjectStore objectStore = classContext.getObjectStore();
taskList = objectStore.get(TaskList.class);
if (taskList == null) {
taskList = new TaskList<T>();
Class<?> currentClass = classContext.getActiveId();
ContainerSetup setup = currentClass.getAnnotation(ContainerSetup.class);
if (setup != null) {
Class<T>[] classes = (Class<T>[]) setup.value();
for (Class<T> clazz : classes) {
taskList.add(clazz.newInstance());
}
}
classContext.getObjectStore().add(TaskList.class, taskList);
ObjectStore suiteStore = getSuiteObjectStore();
suiteStore.get(TaskList.class).addAll(taskList);
}
}
return taskList != null ? taskList : new TaskList<T>();
}