Class CopyCommand<C extends Context>

java.lang.Object
org.apache.commons.chain.generic.CopyCommand<C>
Type Parameters:
C - Type of the context associated with this command
All Implemented Interfaces:
Command<C>

public class CopyCommand<C extends Context> extends Object implements Command<C>
Copy a specified literal value, or a context attribute stored under the fromKey (if any), to the toKey.
Version:
$Revision$ $Date$
Author:
Craig R. McClanahan
  • Constructor Details

    • CopyCommand

      public CopyCommand()
      The Default-Constructor for this class.
  • Method Details

    • getFromKey

      public String getFromKey()
      Return the context attribute key for the source attribute.
      Returns:
      The source attribute key.
    • setFromKey

      public void setFromKey(String fromKey)
      Set the context attribute key for the source attribute.
      Parameters:
      fromKey - The new key
    • getToKey

      public String getToKey()
      Return the context attribute key for the destination attribute.
      Returns:
      The destination attribute key.
    • setToKey

      public void setToKey(String toKey)
      Set the context attribute key for the destination attribute.
      Parameters:
      toKey - The new key
    • getValue

      public String getValue()
      Return the literal value to be copied.
      Returns:
      The literal value.
    • setValue

      public void setValue(String value)
      Set the literal value to be copied.
      Parameters:
      value - The new value
    • execute

      public boolean execute(C context) throws Exception
      Copy a specified literal value, or a context attribute stored under the fromKey (if any), to the toKey.
      Specified by:
      execute in interface Command<C extends Context>
      Parameters:
      context - Context in which we are operating
      Returns:
      false so that processing will continue
      Throws:
      Exception - in the if an error occurs during execution.