Enhydra 5.1 API

org.enhydra.tool.common
Class Replacement

java.lang.Object
  |
  +--org.enhydra.tool.common.Replacement

public class Replacement
extends java.lang.Object

The replacement class defines a search and replace operation for updating source code that was copied from a template file. Replacement object are used by the predefined generators to insert things like application and package names into java source files.


Constructor Summary
Replacement(java.lang.String inFind, java.lang.String inReplaceWith)
          Define a replacement operation using a single replacement string.
Replacement(java.lang.String inFind, java.lang.String[] inReplaceWith)
          Define a replacement operation using an replacement array.
 
Method Summary
 java.lang.String getFind()
          Get the string to search for.
 java.lang.String[] getReplaceWith()
          Get replacement text that can be a one or more stings.
 void setReplaceWith(java.lang.String with)
          Set the replaceWith to a single string value.
 void setReplaceWith(java.lang.String[] with)
          Set the replaceWith to an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Replacement

public Replacement(java.lang.String inFind,
                   java.lang.String[] inReplaceWith)
            throws ToolException
Define a replacement operation using an replacement array.

Throws:
GenerationException - Thrown if either parameter is null, or the find element is an empty string or if the replaceWith array has a length of zero.
ToolException

Replacement

public Replacement(java.lang.String inFind,
                   java.lang.String inReplaceWith)
            throws ToolException
Define a replacement operation using a single replacement string.

Throws:
GenerationException - Thrown if either parameter is null or either element references an empty string.
ToolException
Method Detail

getFind

public java.lang.String getFind()
Get the string to search for.

Returns:
The search for string.

getReplaceWith

public java.lang.String[] getReplaceWith()
Get replacement text that can be a one or more stings. More than one string indicates that the token should be replaced with multiple lines.

Returns:
An array of replacement strings.

setReplaceWith

public void setReplaceWith(java.lang.String[] with)
Set the replaceWith to an array.

Parameters:
with - One or more strings to use as a replacement for the find string. If the array contains more than one string, a new line is inserted for each element of the replaceWith array.

setReplaceWith

public void setReplaceWith(java.lang.String with)
Set the replaceWith to a single string value.

Parameters:
with - String to use as a replacement for the find string.

Enhydra 5.1 API