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

java.lang.Object
  extended by net.sf.mmm.util.text.base.TransformerRule
      extended by net.sf.mmm.util.text.base.SuffixTransformerRule

public class SuffixTransformerRule
extends TransformerRule

This is a simple implementation of the TransformerRule. If the given string ends with a specific suffix, that suffix is replaced by a suffix for the result form.

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

Field Summary
private  String destinationSuffix
           
private  String sourceSuffix
           
 
Constructor Summary
SuffixTransformerRule(String sourceSuffix, String destinationSuffix)
          The constructor.
 
Method Summary
 String transform(String string, String stringLowerCase)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceSuffix

private final String sourceSuffix
See Also:
SuffixTransformerRule(String, String)

destinationSuffix

private final String destinationSuffix
See Also:
SuffixTransformerRule(String, String)
Constructor Detail

SuffixTransformerRule

public SuffixTransformerRule(String sourceSuffix,
                             String destinationSuffix)
The constructor.

Parameters:
sourceSuffix - is the suffix of the plural form. If a plural term ends with that suffix, this rule will apply and replace it with the given singularSuffix.
destinationSuffix - is the suffix of the singular form. It is the replacement for pluralSuffix. Use the empty string if you just want to remove the pluralSuffix.
Method Detail

transform

public String transform(String string,
                        String stringLowerCase)

Specified by:
transform in class TransformerRule
Parameters:
string - is the original string to modify.
stringLowerCase - is the string in lower-case.
Returns:
the replaced string or null if this rule does NOT apply and the string should NOT be replaced.
See Also:
Singularizer.transform(String)


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