Class CharReplacer
- java.lang.Object
-
- org.apache.torque.generator.processor.string.CharReplacer
-
- All Implemented Interfaces:
StringProcessor
- Direct Known Subclasses:
ConstantNameCreator
public class CharReplacer extends Object implements StringProcessor
Replaces characters by a String.
-
-
Field Summary
Fields Modifier and Type Field Description static String
JAVA_CLASSNAME_REPLACEMENT
The String which is usually used as replacement for not allowed characters in java class names.static String
JAVA_CLASSNAME_SPECIAL_CHARS
Characters which are not allowed in java class names
-
Constructor Summary
Constructors Constructor Description CharReplacer()
-
Method Summary
Modifier and Type Method Description String
getToReplace()
Returns a String containing all the characters which should be replaced.String
getToReplaceWith()
Returns the String which are inserted instead of the replaced characters.String
process(String toProcess)
Replaces all characters intoProcess
which occur intoReplace
withtoReplaceWith
and returns the new Stringvoid
setToReplace(String toReplace)
Sets the characters which should be replaced.void
setToReplaceWith(String toReplaceWith)
Sets the String which are inserted instead of the replaced characters.String
toString()
-
-
-
Field Detail
-
JAVA_CLASSNAME_SPECIAL_CHARS
public static final String JAVA_CLASSNAME_SPECIAL_CHARS
Characters which are not allowed in java class names- See Also:
- Constant Field Values
-
JAVA_CLASSNAME_REPLACEMENT
public static final String JAVA_CLASSNAME_REPLACEMENT
The String which is usually used as replacement for not allowed characters in java class names.- See Also:
- Constant Field Values
-
-
Method Detail
-
getToReplace
public String getToReplace()
Returns a String containing all the characters which should be replaced.- Returns:
- the Characters which should be replaced, not null.
-
setToReplace
public void setToReplace(String toReplace)
Sets the characters which should be replaced.- Parameters:
toReplace
- a String containing all the Characters which should be replaced, not null.
-
getToReplaceWith
public String getToReplaceWith()
Returns the String which are inserted instead of the replaced characters.- Returns:
- the replacement, not null.
-
setToReplaceWith
public void setToReplaceWith(String toReplaceWith)
Sets the String which are inserted instead of the replaced characters.- Parameters:
toReplaceWith
- the replacement, not null.
-
process
public String process(String toProcess)
Replaces all characters intoProcess
which occur intoReplace
withtoReplaceWith
and returns the new String- Specified by:
process
in interfaceStringProcessor
- Parameters:
toProcess
- the String in which replacement should occur, not null.- Returns:
- the processed String, not null.
-
-