Class SourceTargetAttributeTransformer
java.lang.Object
org.apache.torque.generator.source.transform.SourceTargetAttributeTransformer
- All Implemented Interfaces:
SourceTransformer
- Direct Known Subclasses:
BeanPropertyMethodNameTransformer,CopyAttributeTransformer
A transformer which has a source attribute and a target attribute.
- Version:
- $Id: SourceTargetAttributeTransformer.java 1839288 2018-08-27 09:48:33Z tv $
-
Constructor Summary
ConstructorsConstructorDescriptionStandard constructor.SourceTargetAttributeTransformer(String sourceAttributeName, String targetAttributeName) Constructor used to set default attribute names. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the attribute which is read as Input.Returns the name of the attribute into which the result is stored.booleanReturns whether the content of the target attribute is overwritten if it exists.voidsetOverwrite(boolean overwrite) Sets whether the content of the target attribute should be overwritten if it exists.voidsetSourceAttributeName(String sourceAttributeName) Sets the name of the attribute which is read as Input.voidsetTargetAttributeName(String targetAttributeName) Sets the name of the attribute into which the result is stored.abstract Objecttransform(Object toTransformRoot, ControllerState controllerState) Performs the transformation.
-
Constructor Details
-
SourceTargetAttributeTransformer
public SourceTargetAttributeTransformer()Standard constructor. -
SourceTargetAttributeTransformer
Constructor used to set default attribute names.- Parameters:
sourceAttributeName- the default sourceAttributeName.targetAttributeName- the default targetAttributeName.
-
-
Method Details
-
getSourceAttributeName
Returns the name of the attribute which is read as Input.- Returns:
- the name of the attribute which is read as Input.
-
setSourceAttributeName
Sets the name of the attribute which is read as Input.- Parameters:
sourceAttributeName- the name of the attribute which is read as Input, not null.- Throws:
NullPointerException- if sourceAttributeName is null.
-
getTargetAttributeName
Returns the name of the attribute into which the result is stored.- Returns:
- the name of the attribute into which the result is stored.
-
setTargetAttributeName
Sets the name of the attribute into which the result is stored.- Parameters:
targetAttributeName- the name of the attribute into which the result is stored, not null.- Throws:
NullPointerException- if targetAttributeName is null.
-
isOverwrite
public boolean isOverwrite()Returns whether the content of the target attribute is overwritten if it exists.- Returns:
- true if the target is overwritten, false if it is only filled when not set.
-
setOverwrite
public void setOverwrite(boolean overwrite) Sets whether the content of the target attribute should be overwritten if it exists.- Parameters:
overwrite- true if the target is overwritten, false if it is only filled when not set.
-
transform
public abstract Object transform(Object toTransformRoot, ControllerState controllerState) throws SourceTransformerException Performs the transformation.- Specified by:
transformin interfaceSourceTransformer- Parameters:
toTransformRoot- the root object of the source tree to transform, not null.controllerState- the state of the controller, not null.- Returns:
- the root element of the transformed source tree, not null.
- Throws:
SourceTransformerException- if the source cannot be transformed.- See Also:
-