org.schmant.task.meta
Class DefaultTargetStrategy

java.lang.Object
  extended by org.schmant.task.meta.DefaultTargetStrategy
All Implemented Interfaces:
TargetStrategy

public class DefaultTargetStrategy
extends Object
implements TargetStrategy

This is the default implementation of the TargetStrategy interface. It puts the target entities on the same location relative to the target directory as the source entity has relative to the source base directory. It does no name transformation at all.

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

Field Summary
static DefaultTargetStrategy INSTANCE
          A singleton instance.
 
Constructor Summary
DefaultTargetStrategy()
           
 
Method Summary
 Object getTarget(ProcessTaskSpec<?> t, DirectoryView baseDir, RelativeLocation rel)
          Create the target location for the entity being processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final DefaultTargetStrategy INSTANCE
A singleton instance. No need to create several instances of this class since it does not contain any internal state.

Constructor Detail

DefaultTargetStrategy

public DefaultTargetStrategy()
Method Detail

getTarget

public Object getTarget(ProcessTaskSpec<?> t,
                        DirectoryView baseDir,
                        RelativeLocation rel)
Description copied from interface: TargetStrategy
Create the target location for the entity being processed.

Specified by:
getTarget in interface TargetStrategy
Parameters:
t - The task to get the target for. This method should not set the task's target property. (Or any other property, for that matter.) The source property is set on the task. If the task factory is a closure, this parameter will be null.
baseDir - The base target directory for the process.
rel - The processed entity's location relative to its base directory.
Returns:
The target location for the processed entity. This can for instance be a FutureEntity. The object that is returned here is set to the nested task's target property. See the task factory documentation for the nested task for the different kinds of object types that it can handle.