net.sf.mmm.util.text.base
Class AbstractTextTransformer

java.lang.Object
  extended by net.sf.mmm.util.text.base.AbstractTextTransformer
All Implemented Interfaces:
Transformer<String>
Direct Known Subclasses:
EnglishSingularizer

public abstract class AbstractTextTransformer
extends Object
implements Transformer<String>

This is the abstract base implementation of a Transformer for strings.

Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Constructor Summary
AbstractTextTransformer()
          The constructor.
 
Method Summary
protected abstract  List<TransformerRule> getRules()
          This method gets the list of rules.
 String transform(String string)
          This method transforms a given original value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTextTransformer

public AbstractTextTransformer()
The constructor.

Method Detail

getRules

protected abstract List<TransformerRule> getRules()
This method gets the list of rules. These rules are processed in the order of occurrence. If a rule matches (does NOT return null ), that result is taken as singular form and no further rule is invoked.

Returns:
the rules.

transform

public String transform(String string)
This method transforms a given original value. This value must NOT be modified by this method. To change the original value a new value has to be created and returned instead. If the value should NOT be changed, the original value (the exact same instance) should be returned. This implementation processes the rules in the order of occurrence. If a rule matches (does NOT return null ), that result is taken as result and no further rule is invoked.

Specified by:
transform in interface Transformer<String>
Parameters:
string - is the original value.
Returns:
the transformed value. May only be null if explicitly documented by the implementation. The receiver of a Transformer should also document if null is a legal result.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.