org.schmant.task.template.text
Class AbstractTextInsertionTask<T extends AbstractTextInsertionTask<T>>
java.lang.Object
org.schmant.support.AbstractArgumentChecker
org.schmant.task.stub.AbstractTask<T>
org.schmant.task.stub.AbstractActionTask<T>
org.schmant.task.stub.AbstractProcessTask<T>
org.schmant.task.template.text.AbstractTextInsertionTask<T>
- All Implemented Interfaces:
- Producer<WritableFile>, 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:
- AbstractLinkInsertionTask, ApiLinksTask, IncludeFilesTask, TextReplaceTask
public abstract class AbstractTextInsertionTask<T extends AbstractTextInsertionTask<T>>
- extends AbstractProcessTask<T>
- implements Producer<WritableFile>
Abstract base class for a task that use regular expressions to find places in
a text file where it edits the text using a
ReplacementTextStrategy
.
- Since:
- 0.8
- Author:
- Karl Gustafsson
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, setLogFooter, setLogHeader, setReportLevel, setTraceLogging |
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
AbstractTextInsertionTask
public AbstractTextInsertionTask()
getInputEncoding
protected final Charset getInputEncoding()
getOutputEncoding
protected final Charset getOutputEncoding()
getBufferSize
protected final int getBufferSize()
getTempDirectory
protected final Object getTempDirectory()
get
public final WritableFile get()
- Description copied from interface:
Producer
- Returns the produced object, or
null
if nothing is produced
yet.
This method should be implemented thread-safe.
- Specified by:
get
in interface Producer<WritableFile>
- Returns:
- The produced object.
isErrorIfReplaceNotFound
protected boolean isErrorIfReplaceNotFound()
- If a replace is not found, is that an error?
This method returns false
. Subclasses may override it to return
something else.
- Returns:
false
.
createReplaces
protected abstract List<? extends PatternAndStrategy> createReplaces(ReadableFile source)
- Subclasses implement this method to create the replaces that it uses.
runInternal
protected void runInternal(Report r)
throws Exception
- Description copied from class:
AbstractTask
- Subclasses implement this. The task is
AbstractTask.validate(Report)
:d before
this method is called, see AbstractTask.run()
.
- Specified by:
runInternal
in class AbstractTask<T extends AbstractTextInsertionTask<T>>
- Parameters:
r
- The current thread's Report
.
- Throws:
Exception
- On errors.
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 AbstractTextInsertionTask<T>>
- Overrides:
copyProperties
in class AbstractProcessTask<T extends AbstractTextInsertionTask<T>>
- Parameters:
spec
- The specification to copy properties to.