com.basecmp.core.util
Class ReplaceTransformer

java.lang.Object
  extended bycom.basecmp.core.util.ReplaceTransformer
Direct Known Subclasses:
ConstantReplaceTransformer, ToStringReplaceTransformer

public abstract class ReplaceTransformer
extends java.lang.Object

Skeleton Transformer implementation that executes a replace-operation with the regular expression given at instantiation on the toString()-version of input-object. Created on 14.05.2006

Author:
Wolfgang Schröder

Constructor Summary
ReplaceTransformer(java.lang.String regex)
          Mainconstructor.
 
Method Summary
abstract  java.lang.String getReplacement(java.lang.String[] matchingGroups)
          Delivers for the given groups of a regular-expression-match a replacement, which is used by the transform-method.
 java.lang.Object transform(java.lang.Object input)
          Converts the given input-object using toString() and searches this string-version using the regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplaceTransformer

public ReplaceTransformer(java.lang.String regex)
Mainconstructor.

Parameters:
regex - The regular expression (JDK-style) which is used by the transformation.
Method Detail

getReplacement

public abstract java.lang.String getReplacement(java.lang.String[] matchingGroups)
Delivers for the given groups of a regular-expression-match a replacement, which is used by the transform-method. Subclasses must implement this method according to their needs.


transform

public java.lang.Object transform(java.lang.Object input)
Converts the given input-object using toString() and searches this string-version using the regular expression. For each occurence the abstract method getReplacement() is called.



Copyright © 2004 by basecmp® - Professional Web Solutions