net.sf.mmm.util.transformer.base
Class RegexStringTransformerRule

java.lang.Object
  extended by net.sf.mmm.util.transformer.base.RegexStringTransformer
      extended by net.sf.mmm.util.transformer.base.RegexStringTransformerRule
All Implemented Interfaces:
StringTransformerRule, Transformer<String>

public class RegexStringTransformerRule
extends RegexStringTransformer
implements StringTransformerRule

This class is a RegexStringTransformer that implements the StringTransformerRule interface by adding the stop-on-match flag.

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

Field Summary
private  boolean stopOnMatch
           
 
Constructor Summary
RegexStringTransformerRule()
          The non-arg constructor.
RegexStringTransformerRule(Pattern pattern, String replacement, boolean replaceAll, boolean stopOnMatch)
          The constructor.
 
Method Summary
 boolean isStopOnMatch()
          This method determines if this rule will stop further proceeding if it matched.
 
Methods inherited from class net.sf.mmm.util.transformer.base.RegexStringTransformer
getPattern, getReplacement, isReplaceAll, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.transformer.api.Transformer
transform
 

Field Detail

stopOnMatch

private boolean stopOnMatch
See Also:
isStopOnMatch()
Constructor Detail

RegexStringTransformerRule

public RegexStringTransformerRule()
The non-arg constructor.
NOTE:
This constructor should not be called directly! It is only intended for reflective access (e.g. for JAXB).


RegexStringTransformerRule

public RegexStringTransformerRule(Pattern pattern,
                                  String replacement,
                                  boolean replaceAll,
                                  boolean stopOnMatch)
The constructor.

Parameters:
pattern - is the pattern used for conversion.
replacement - is the replacement to fill in the string to convert.
replaceAll - - if true Matcher.replaceAll(String) will be used, else if false Matcher.replaceFirst(String).
stopOnMatch - if true and the pattern of this rule matches no further rules will be executed.
Method Detail

isStopOnMatch

public boolean isStopOnMatch()
Description copied from interface: StringTransformerRule
This method determines if this rule will stop further proceeding if it matched. Since the flow of proceeding is performed outside of this transformer rule, the caller needs to identify if this rule matched. This is done via the convention that the rule returns the original value in #transform(String) if it did NOT match.
If you are familiar with apache httpd you can think of this flag as the "L" in a rewrite rule.

Specified by:
isStopOnMatch in interface StringTransformerRule
Returns:
the lastRule


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