org.apache.torque.generator.source.transform
Class SourceTargetAttributeTransformer

java.lang.Object
  extended by org.apache.torque.generator.source.transform.SourceTargetAttributeTransformer
All Implemented Interfaces:
SourceTransformer
Direct Known Subclasses:
BeanPropertyMethodNameTransformer, CopyAttributeTransformer

public abstract class SourceTargetAttributeTransformer
extends Object
implements SourceTransformer

A transformer which has a source attribute and a target attribute.

Version:
$Id: SourceTargetAttributeTransformer.java 1331190 2012-04-27 02:41:35Z tfischer $

Constructor Summary
SourceTargetAttributeTransformer()
          Standard constructor.
SourceTargetAttributeTransformer(String sourceAttributeName, String targetAttributeName)
          Constructor used to set default attribute names.
 
Method Summary
 String getSourceAttributeName()
          Returns the name of the attribute which is read as Input.
 String getTargetAttributeName()
          Returns the name of the attribute into which the result is stored.
 boolean isOverwrite()
          Returns whether the content of the target attribute is overwritten if it exists.
 void setOverwrite(boolean overwrite)
          Sets whether the content of the target attribute should be overwritten if it exists.
 void setSourceAttributeName(String sourceAttributeName)
          Sets the name of the attribute which is read as Input.
 void setTargetAttributeName(String targetAttributeName)
          Sets the name of the attribute into which the result is stored.
abstract  SourceElement transform(SourceElement toTransformRoot, ControllerState controllerState)
          Performs the transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceTargetAttributeTransformer

public SourceTargetAttributeTransformer()
Standard constructor.


SourceTargetAttributeTransformer

public SourceTargetAttributeTransformer(String sourceAttributeName,
                                        String targetAttributeName)
Constructor used to set default attribute names.

Parameters:
sourceAttributeName - the default sourceAttributeName.
targetAttributeName - the default targetAttributeName.
Method Detail

getSourceAttributeName

public String getSourceAttributeName()
Returns the name of the attribute which is read as Input.

Returns:
the name of the attribute which is read as Input.

setSourceAttributeName

public void setSourceAttributeName(String sourceAttributeName)
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

public String 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

public void setTargetAttributeName(String targetAttributeName)
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 SourceElement transform(SourceElement toTransformRoot,
                                        ControllerState controllerState)
                                 throws SourceTransformerException
Performs the transformation.

Specified by:
transform in interface SourceTransformer
Parameters:
toTransformRoot - the root element 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:
SourceTransformer.transform(SourceElement, ControllerState)


Copyright © 2000-2012 The Apache Software Foundation. All Rights Reserved.