Class BeanPropertyMethodNameTransformer
- java.lang.Object
-
- org.apache.torque.generator.source.transform.SourceTargetAttributeTransformer
-
- 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 1855923 2019-03-20 16:19:39Z gk $
-
-
Constructor Summary
Constructors Constructor Description BeanPropertyMethodNameTransformer()
Constructor.
-
Method Summary
Modifier and Type Method Description 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(Object rootObject, 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
-
-
-
-
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:
suffix
- the suffix for the result, not null.- Throws:
NullPointerException
- if suffix is null.
-
transform
public SourceElement transform(Object rootObject, ControllerState controllerState) throws SourceTransformerException
Fills the target attribute according to the settings.- Specified by:
transform
in interfaceSourceTransformer
- Specified by:
transform
in classSourceTargetAttributeTransformer
- Parameters:
rootObject
- the root of the source graph, not null.controllerState
- the controller state.- Returns:
- the modified source element, not null.
- Throws:
SourceTransformerException
- if rootObject is not a SourceElement.IllegalStateException
- if targetAttributeName was not set.- See Also:
SourceTransformer.transform(Object, ControllerState)
-
-