Package org.opt4j.config
Class Task
- java.lang.Object
-
- org.opt4j.config.Task
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTask.StateTheTask.Stateof a task.
-
Field Summary
Fields Modifier and Type Field Description protected Exceptioneprotected booleanisInitprotected Set<TaskStateListener>listenersprotected List<com.google.inject.Module>modulesprotected Task.Statestate
-
Constructor Summary
Constructors Constructor Description Task()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddStateListener(TaskStateListener listener)Adds aTaskStateListener.Voidcall()abstract voidexecute()Executes theTask.ExceptiongetException()Collection<com.google.inject.Module>getModules()Returns a copy of theModules of thisTask.Task.StategetState()Returns the state of theTask.voidinit(com.google.inject.Module... modules)Initializes theTaskwith modules.voidinit(Collection<com.google.inject.Module> modules)Initializes theTaskwith modules.voidremoveStateListener(TaskStateListener listener)Removes aTaskStateListener.protected voidsetState(Task.State state)Sets the state of theTask.StringtoString()
-
-
-
Field Detail
-
state
protected Task.State state
-
e
protected Exception e
-
modules
protected final List<com.google.inject.Module> modules
-
isInit
protected boolean isInit
-
listeners
protected final Set<TaskStateListener> listeners
-
-
Method Detail
-
init
public void init(com.google.inject.Module... modules)
Initializes theTaskwith modules.- Parameters:
modules- the modules for the task- See Also:
init(Collection)
-
init
public void init(Collection<com.google.inject.Module> modules)
Initializes theTaskwith modules. Note that if a module is aPropertyModule, a copy is made with thePropertyModule.clone()method. If theModuleis not aPropertyModule, the module is copied as a reference, i.e., it can be changed until theexecute()is called.- Parameters:
modules- the modules for the task
-
getException
public Exception getException()
- Returns:
- the occurred exception
-
getState
public Task.State getState()
Returns the state of theTask.- Returns:
- the state of the task
-
setState
protected void setState(Task.State state)
Sets the state of theTask.- Parameters:
state- the state of the task to be set
-
addStateListener
public void addStateListener(TaskStateListener listener)
Adds aTaskStateListener.- Parameters:
listener- the listener to be added- See Also:
removeStateListener(org.opt4j.config.TaskStateListener)
-
removeStateListener
public void removeStateListener(TaskStateListener listener)
Removes aTaskStateListener.- Parameters:
listener- the listener to be removed- See Also:
addStateListener(org.opt4j.config.TaskStateListener)
-
getModules
public Collection<com.google.inject.Module> getModules()
Returns a copy of theModules of thisTask.- Returns:
- a set of modules
-
-