Package org.apache.torque.generator.source.transform

# Class CopyAttributeTransformer

java.lang.Object
org.apache.torque.generator.source.transform.SourceTargetAttributeTransformer
org.apache.torque.generator.source.transform.CopyAttributeTransformer

All Implemented Interfaces:
  `SourceTransformer`

public class CopyAttributeTransformer extends SourceTargetAttributeTransformer
Fills an attribute with the content of another attribute. It can be configured whether the target attribute is overwritten if it is not set. $Id: CopyAttributeTransformer.java 1839288 2018-08-27 09:48:33Z tv $

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CopyAttributeTransformer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CopyAttributeTransformer

    public CopyAttributeTransformer()

- ## Method Details

  - ### transform

    public SourceElement transform(Object rootObject, ControllerState controllerState) throws SourceTransformerException
    Fills the target attribute according to the settings.
    Specified by:
      `transform` in interface `SourceTransformer`
    Specified by:
      `transform` in class `SourceTargetAttributeTransformer`
    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 sourceAttributeName or targetAttributeName was not set.
    See Also:
      - `SourceTransformer.transform(Object, ControllerState)`