org.schmant.task.text
Class AbstractAddTextTask<T extends AbstractAddTextTask<T>>

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.stub.AbstractActionTask<T>
              extended by org.schmant.task.stub.AbstractProcessTask<T>
                  extended by org.schmant.task.text.AbstractAddTextTask<T>
All Implemented Interfaces:
TaskDependency, ActionTaskConfigurable<T>, ActionTaskSpec<T>, LoggingConfigurable<T>, OverwriteConfigurable<T>, SourceConfigurable<T>, SourceConfigured, TargetConfigurable<T>, TargetConfigured, GeneratorTaskConfigurable<T>, GeneratorTaskSpec<T>, ProcessTaskConfigurable<T>, ProcessTaskSpec<T>, Task, TaskRunnable, TaskSpecification<T>
Direct Known Subclasses:
TextAppendTask, TextPrependTask

public abstract class AbstractAddTextTask<T extends AbstractAddTextTask<T>>
extends AbstractProcessTask<T>

Abstract base class for tasks that add text to files.

Since:
0.5
Author:
Karl Gustafsson
Task_package:
org.schmant.task.base

Field Summary
 
Fields inherited from interface org.schmant.task.confable.OverwriteConfigurable
DEFAULT_OVERWRITE_STRATEGY
 
Constructor Summary
AbstractAddTextTask()
           
 
Method Summary
 void copyProperties(T spec)
          Override the implementation from AbstractTask to copy the source properties.
protected  Charset getInputEncoding()
           
protected  Charset getOutputEncoding()
           
protected  Object getText()
           
protected  Charset getTextEncoding()
           
 T setInputEncoding(Charset cs)
           
 T setInputEncoding(String name)
           
 T setOutputEncoding(Charset cs)
           
 T setOutputEncoding(String name)
           
 T setText(Object o)
           
 T setTextEncoding(Charset cs)
           
protected  Collection<String> validate(Report r)
          Override the method inherited from AbstractTask to give a validation error if no source is set (and AbstractActionTask.isSourcesMandatory() is true).
 
Methods inherited from class org.schmant.task.stub.AbstractProcessTask
getOverwriteStrategy, getTarget, isTargetMandatory, setOverwrite, setOverwriteStrategy, setTarget, toString
 
Methods inherited from class org.schmant.task.stub.AbstractActionTask
addSource, addSources, clearSources, getRelativeToBase, getSource, getSources, isMoreThanOneSourceAllowed, isSourcesMandatory, setRelativeToBase, setSource, setSources
 
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.confable.SourceConfigurable
addSource, addSources, clearSources, setRelativeToBase, setSource, setSources
 
Methods inherited from interface org.schmant.task.confable.SourceConfigured
getSource, getSources
 
Methods inherited from interface org.schmant.task.TaskSpecification
createTask
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 

Constructor Detail

AbstractAddTextTask

public AbstractAddTextTask()
Method Detail

setText

public final T setText(Object o)

getText

protected final Object getText()

setInputEncoding

public final T setInputEncoding(Charset cs)

setInputEncoding

public final T setInputEncoding(String name)

getInputEncoding

protected final Charset getInputEncoding()

setOutputEncoding

public final T setOutputEncoding(Charset cs)

setOutputEncoding

public final T setOutputEncoding(String name)

getOutputEncoding

protected final Charset getOutputEncoding()

setTextEncoding

public final T setTextEncoding(Charset cs)

getTextEncoding

protected final Charset getTextEncoding()

validate

protected Collection<String> validate(Report r)
Description copied from class: AbstractActionTask
Override the method inherited from AbstractTask to give a validation error if no source is set (and AbstractActionTask.isSourcesMandatory() is true).

Subclasses may override this to add their own validations.

Overrides:
validate in class AbstractProcessTask<T extends AbstractAddTextTask<T>>
Parameters:
r - A report to log warning and debug messages to. Validation errors should not be logged, though. They are logged later.
Returns:
A collection of error messages.

copyProperties

public void copyProperties(T spec)
Description copied from class: AbstractActionTask
Override the implementation from AbstractTask to copy the source properties. Subclasses must override this to copy their own properties.

Specified by:
copyProperties in interface TaskSpecification<T extends AbstractAddTextTask<T>>
Overrides:
copyProperties in class AbstractProcessTask<T extends AbstractAddTextTask<T>>
Parameters:
spec - The specification to copy properties to.