|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.schmant.task.stub.AbstractTaskFactory<T,U>
public abstract class AbstractTaskFactory<T extends AbstractTaskFactory<T,U>,U extends TaskSpecification<U>>
This is a starting point for TaskFactory
implementations.
A task factory configures a Task
by configuring its TaskSpecification
object. When a Task
is created, a flag is set that says that that
specification object cannot be used anymore. The
next time a setter method is called on the task factory, the factory creates
a new TaskSpecification
object and copies the previous specification
object's configuration by calling its TaskSpecification.copyProperties(TaskSpecification)
method.
Constructor Summary | |
---|---|
AbstractTaskFactory()
|
Method Summary | |
---|---|
T |
copy()
Create a copy of this task factory. |
Task |
create()
Create a task. |
protected abstract U |
createSpecification()
Subclasses implement this to create the task specification object that this factory uses to configure the task that it is creating. |
Task |
getLastCreated()
Get the last created task. |
U |
getSpecification()
Subclasses use this to get the task specification that they are currently configuring. |
protected T |
getThis()
This method returns this object cast to its actual type. |
Task |
run()
Run the task and return it. |
T |
setLogFooter(String s)
Set the task's log footer (the message that is logged to level info after the task has completed successfully). |
T |
setLogHeader(String s)
Set the task's log header (the message that is logged to level info before the task is run). |
T |
setReportLevel(Level l)
Set the Report level to use when running tasks
created by this factory. |
T |
setTraceLogging(boolean b)
Enable or disable trace logging for tasks created by this factory. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractTaskFactory()
Method Detail |
---|
protected abstract U createSpecification()
public final U getSpecification()
createSpecification()
method the first time this method is
called and whenever a new specification must be created since the current
specification has been used to create a task.
getSpecification
in interface TaskFactory<T extends AbstractTaskFactory<T,U>,U extends TaskSpecification<U>>
protected final T getThis()
this
public final T setLogHeader(String s)
LoggingConfigurable
info
before the task is run). If no log header is set, the default log
header from AbstractTask.getDefaultLogHeader()
is used.
setLogHeader
in interface LoggingConfigurable<T extends AbstractTaskFactory<T,U>>
s
- The log header. Set to null
to not log a header.
this
public final T setLogFooter(String s)
LoggingConfigurable
info
after the task has completed successfully). Set to null
to
disable the footer.
setLogFooter
in interface LoggingConfigurable<T extends AbstractTaskFactory<T,U>>
s
- The footer to log.
this
public final Task create()
TaskFactory
create
in interface TaskFactory<T extends AbstractTaskFactory<T,U>,U extends TaskSpecification<U>>
public final T copy()
TaskFactory
TaskSpecification
object having the same configuration as this
task factory's specification object.
copy
in interface TaskFactory<T extends AbstractTaskFactory<T,U>,U extends TaskSpecification<U>>
public final Task getLastCreated()
TaskFactory
getLastCreated
in interface TaskFactory<T extends AbstractTaskFactory<T,U>,U extends TaskSpecification<U>>
public T setTraceLogging(boolean b)
LoggingConfigurable
Task configuration is trace logged if trace logging is enabled for the task itself or for its task factory.
setTraceLogging
in interface LoggingConfigurable<T extends AbstractTaskFactory<T,U>>
b
- Set to true
to enable trace logging.
this
.public T setReportLevel(Level l)
LoggingConfigurable
Report
level to use when running tasks
created by this factory.
setReportLevel
in interface LoggingConfigurable<T extends AbstractTaskFactory<T,U>>
l
- The report level. If null
, the report level will not be
modified.
this
.public Task run()
TaskRunnable
run
in interface TaskRunnable
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |