Package org.opt4j.config
Class Task
- java.lang.Object
-
- org.opt4j.config.Task
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Task.State
TheTask.State
of a task.
-
Field Summary
Fields Modifier and Type Field Description protected Exception
e
protected boolean
isInit
protected Set<TaskStateListener>
listeners
protected List<com.google.inject.Module>
modules
protected Task.State
state
-
Constructor Summary
Constructors Constructor Description Task()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addStateListener(TaskStateListener listener)
Adds aTaskStateListener
.Void
call()
abstract void
execute()
Executes theTask
.Exception
getException()
Collection<com.google.inject.Module>
getModules()
Returns a copy of theModule
s of thisTask
.Task.State
getState()
Returns the state of theTask
.void
init(com.google.inject.Module... modules)
Initializes theTask
with modules.void
init(Collection<com.google.inject.Module> modules)
Initializes theTask
with modules.void
removeStateListener(TaskStateListener listener)
Removes aTaskStateListener
.protected void
setState(Task.State state)
Sets the state of theTask
.String
toString()
-
-
-
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 theTask
with modules.- Parameters:
modules
- the modules for the task- See Also:
init(Collection)
-
init
public void init(Collection<com.google.inject.Module> modules)
Initializes theTask
with modules. Note that if a module is aPropertyModule
, a copy is made with thePropertyModule.clone()
method. If theModule
is 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 theModule
s of thisTask
.- Returns:
- a set of modules
-
-