|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.schmant.support.AbstractArgumentChecker
org.schmant.task.stub.AbstractTask<T>
org.schmant.task.stub.AbstractActionTask<T>
public abstract class AbstractActionTask<T extends ActionTaskSpec<T>>
This class may be used as a starting point for action task implementations.
Constructor Summary | |
---|---|
AbstractActionTask()
|
Method Summary | |
---|---|
T |
addSource(Object o)
Add one or several sources. |
T |
addSources(Object o)
This method does the same as SourceConfigurable.addSource(Object) |
T |
clearSources()
Clear the collection of sources. |
void |
copyProperties(T spec)
Override the implementation from AbstractTask to copy the
source properties. |
protected RelativeLocation |
getRelativeToBase()
|
Object |
getSource()
Get the source object when there is only one source set. |
List<Object> |
getSources()
Get the sources set on this action task. |
protected boolean |
isMoreThanOneSourceAllowed()
Is more than one source object allowed? This method returns false
. |
protected boolean |
isSourcesMandatory()
Must the sources property be set? This method returns true . |
T |
setRelativeToBase(RelativeLocation rel)
This property is set with the task's source's location relative to a base location if the task is run within a recursive task. |
T |
setSource(Object o)
Set one or several sources, discarding previously set sources. |
T |
setSources(Object o)
This method does the same as SourceConfigurable.setSource(Object) |
String |
toString()
Default implementation for tasks. |
protected Collection<String> |
validate(Report r)
Override the method inherited from AbstractTask to give a validation
error if no source is set (and isSourcesMandatory() is true ). |
Methods inherited from class org.schmant.task.stub.AbstractTask |
---|
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, runInternal, setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
Methods inherited from class org.schmant.support.AbstractArgumentChecker |
---|
check, check, check, check |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.schmant.task.TaskSpecification |
---|
createTask |
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable |
---|
setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
Constructor Detail |
---|
public AbstractActionTask()
Method Detail |
---|
public final T setSource(Object o)
SourceConfigurable
setSource
in interface SourceConfigurable<T extends ActionTaskSpec<T>>
o
- The source. If this is a Collection
or an
array, it is flattened (see
FlatteningList
), and all objects in
the collection or array are set.
this
public final T setSources(Object o)
SourceConfigurable
SourceConfigurable.setSource(Object)
setSources
in interface SourceConfigurable<T extends ActionTaskSpec<T>>
o
- The source or sources.
this
public final T addSource(Object o)
SourceConfigurable
addSource
in interface SourceConfigurable<T extends ActionTaskSpec<T>>
o
- The source. If this is a Collection
or an
array, it is flattened (see
FlatteningList
), and all sources in the
collection or array are added.
this
public final T addSources(Object o)
SourceConfigurable
SourceConfigurable.addSource(Object)
addSources
in interface SourceConfigurable<T extends ActionTaskSpec<T>>
o
- The source or sources.
this
public final T clearSources()
SourceConfigurable
clearSources
in interface SourceConfigurable<T extends ActionTaskSpec<T>>
this
.public List<Object> getSources()
Subclasses may override this method to add sources that are set via other properties.
getSources
in interface SourceConfigured
public Object getSource()
isMoreThanOneSourceAllowed()
method returns false
.
getSource
in interface SourceConfigured
null
if no source is set.public final T setRelativeToBase(RelativeLocation rel)
SourceConfigurable
If the SourceConfigurable
(this object) is an action task factory
that is used in a recursive action task, the recursive action
task sets this property for each created task.
setRelativeToBase
in interface SourceConfigurable<T extends ActionTaskSpec<T>>
rel
- The source's location relative to the base location.
this
protected final RelativeLocation getRelativeToBase()
protected boolean isSourcesMandatory()
true
.
Subclasses may override this method to return false
if the
sources property is not mandatory.
true
, always.protected boolean isMoreThanOneSourceAllowed()
false
. Subclasses override this method to return true
if they
allow several sources.
This method will only be called if isSourcesMandatory()
returns
true
.
false
, alwaysprotected Collection<String> validate(Report r)
AbstractTask
to give a validation
error if no source is set (and isSourcesMandatory()
is true
).
Subclasses may override this to add their own validations.
validate
in class AbstractTask<T extends ActionTaskSpec<T>>
r
- A report to log warning and debug messages to. Validation errors
should not be logged, though. They are logged later.
public String toString()
AbstractTask
This implementation just returns the class name.
toString
in class AbstractTask<T extends ActionTaskSpec<T>>
public void copyProperties(T spec)
AbstractTask
to copy the
source properties. Subclasses must override this to copy their own
properties.
copyProperties
in interface TaskSpecification<T extends ActionTaskSpec<T>>
copyProperties
in class AbstractTask<T extends ActionTaskSpec<T>>
spec
- The specification to copy properties to.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |