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

java.lang.Object
  extended by org.apache.torque.generator.source.transform.SourceTargetAttributeTransformer
      extended by org.apache.torque.generator.source.transform.BeanPropertyMethodNameTransformer
All Implemented Interfaces:
SourceTransformer

public class BeanPropertyMethodNameTransformer
extends SourceTargetAttributeTransformer

Converts a source element Attribute such that it can be used as method name. The base of the method name is the attribute content, with special characters removed and case corrected where necessary. Optionally, a prefix and/or suffix can be added. The result is stored into another attribute of the same source element.

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

Constructor Summary
BeanPropertyMethodNameTransformer()
          Constructor.
 
Method Summary
 String getSuffix()
          Returns the suffix which is added after the input string.
 String getTargetNamePrefix()
          Returns the prefix which is added in front of the input string.
 void setPrefix(String prefix)
          Sets the prefix which is added in front of the input string.
 void setSuffix(String suffix)
          Sets the suffix which is added after of the input string.
 SourceElement transform(SourceElement sourceElement, ControllerState controllerState)
          Fills the target attribute according to the settings.
 
Methods inherited from class org.apache.torque.generator.source.transform.SourceTargetAttributeTransformer
getSourceAttributeName, getTargetAttributeName, isOverwrite, setOverwrite, setSourceAttributeName, setTargetAttributeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertyMethodNameTransformer

public BeanPropertyMethodNameTransformer()
Constructor.

Method Detail

getTargetNamePrefix

public String getTargetNamePrefix()
Returns the prefix which is added in front of the input string.

Returns:
the prefix for the result, not null.

setPrefix

public void setPrefix(String prefix)
Sets the prefix which is added in front of the input string.

Parameters:
prefix - the prefix for the result, not null.
Throws:
NullPointerException - if prefix is null.

getSuffix

public String getSuffix()
Returns the suffix which is added after the input string.

Returns:
the suffix for the result, not null.

setSuffix

public void setSuffix(String suffix)
Sets the suffix which is added after of the input string.

Parameters:
prefix - the suffix for the result, not null.
Throws:
NullPointerException - if suffix is null.

transform

public SourceElement transform(SourceElement sourceElement,
                               ControllerState controllerState)
Fills the target attribute according to the settings.

Specified by:
transform in interface SourceTransformer
Specified by:
transform in class SourceTargetAttributeTransformer
Parameters:
sourceElement - the source element to modify, not null.
controllerState - the controller state.
Returns:
the modified source element, not null.
Throws:
IllegalStateException - if targetAttributeName was not set.
See Also:
SourceTransformer.transform(SourceElement, ControllerState)


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