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

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

public class GetterSetterNameTransformer
extends Object
implements SourceTransformer

Takes a property name as input from a source element attribute and generates a getter and a setter name from it.

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

Constructor Summary
GetterSetterNameTransformer()
           
 
Method Summary
 String getAttributeName()
          Returns the name of the source element attribute.
 String getGetterNameAttribute()
          Returns the name of the target element attribute for the getter name.
 String getSetterNameAttribute()
          Returns the name of the target element attribute for the setter name.
 void setAttributeName(String attributeName)
          Sets the name of the source element attribute.
 void setGetterNameAttribute(String getterNameAttribute)
          Sets the name of the target element attribute for the getter name.
 void setSetterNameAttribute(String setterNameAttribute)
          Sets the name of the target element attribute for the setter name.
 SourceElement transform(SourceElement sourceElement, ControllerState controllerState)
          Fills the target attributes according to the settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetterSetterNameTransformer

public GetterSetterNameTransformer()
Method Detail

getAttributeName

public String getAttributeName()
Returns the name of the source element attribute.

Returns:
the name of the source attribute, not null.

setAttributeName

public void setAttributeName(String attributeName)
Sets the name of the source element attribute.

Parameters:
attributeName - the name of the source attribute, not null.
Throws:
NullPointerException - if attributeName is null.

getGetterNameAttribute

public String getGetterNameAttribute()
Returns the name of the target element attribute for the getter name.

Returns:
the name of the getter name target attribute, not null.

setGetterNameAttribute

public void setGetterNameAttribute(String getterNameAttribute)
Sets the name of the target element attribute for the getter name.

Parameters:
getterNameAttribute - the name of the getter name target attribute, not null.
Throws:
NullPointerException - if getterNameAttribute is null.

getSetterNameAttribute

public String getSetterNameAttribute()
Returns the name of the target element attribute for the setter name.

Returns:
the name of the setter name target attribute, not null.

setSetterNameAttribute

public void setSetterNameAttribute(String setterNameAttribute)
Sets the name of the target element attribute for the setter name.

Parameters:
getterNameAttribute - the name of the setter name target attribute, not null.
Throws:
NullPointerException - if setterNameAttribute is null.

transform

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

Specified by:
transform in interface SourceTransformer
Parameters:
sourceElement - the source element to modify, not null.
controllerState - the controller state.
Returns:
the modified source element, not null.
Throws:
IllegalStateException - if sourceAttributeName or targetAttributeName was not set.


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