biz.c24.io.api.data
Class XercesRegExpEvaluator

java.lang.Object
  extended by biz.c24.io.api.data.XercesRegExpEvaluator
All Implemented Interfaces:
RegExpEvaluator

public class XercesRegExpEvaluator
extends Object
implements RegExpEvaluator

An implementation of the XercesRegExpEvaluator that uses the Regular Expression library in Xerces. For more information about the Xerces Regular Expression library please visit: http://xml.apache.org/xerces-j/apiDocs/org/apache/xerces/utils/regex/RegularExpression.html

Version:
$Revision: 10102 $ $Date: 2008-03-21 14:33:15 -0400 (Fri, 21 Mar 2008) $

Constructor Summary
XercesRegExpEvaluator()
          Creates a new instance.
XercesRegExpEvaluator(String regex)
          Creates a new instance with the specified regex.
 
Method Summary
 String getRegex()
          Returns the regular expression in plain text form.
 boolean matches(String value)
          Returns true if the given String is matched by the regular expression of this RegExpEvaluator.
 String replace(String value, String replacement, boolean firstOnly)
          Replaces all instances of the regular expression with the replacement string in the supplied value and returns the result.
 void setRegex(String regex)
          Sets the regular expression to match against during a call to #matches.
 String[] split(String value)
          Splits the supplied value according to the regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XercesRegExpEvaluator

public XercesRegExpEvaluator()
Creates a new instance.


XercesRegExpEvaluator

public XercesRegExpEvaluator(String regex)
Creates a new instance with the specified regex.

Parameters:
regex - The regular expression
Method Detail

setRegex

public void setRegex(String regex)
Sets the regular expression to match against during a call to #matches.

Specified by:
setRegex in interface RegExpEvaluator
Parameters:
regex - the regular expression

getRegex

public String getRegex()
Description copied from interface: RegExpEvaluator
Returns the regular expression in plain text form.

Specified by:
getRegex in interface RegExpEvaluator
Returns:
The regular expression.

matches

public boolean matches(String value)
Returns true if the given String is matched by the regular expression of this RegExpEvaluator.

Specified by:
matches in interface RegExpEvaluator
Parameters:
value - the String to check the production of
Returns:
true if the given string matches the regular expression of this RegExpEvaluator
See Also:
setRegex(java.lang.String)

split

public String[] split(String value)
Description copied from interface: RegExpEvaluator
Splits the supplied value according to the regular expression.
This is an optional method - implementations which don't support it will throw an UnsupportedOperationException.

Specified by:
split in interface RegExpEvaluator
Parameters:
value - The value to split.
Returns:
The array of tokens.

replace

public String replace(String value,
                      String replacement,
                      boolean firstOnly)
Description copied from interface: RegExpEvaluator
Replaces all instances of the regular expression with the replacement string in the supplied value and returns the result.
This is an optional method - implementations which don't support it will throw an UnsupportedOperationException.

Specified by:
replace in interface RegExpEvaluator
Parameters:
value - The value containing the replacements.
replacement - The string use as the replacement.
firstOnly - Whether to replace only the first instance or all instances.
Returns:
The resulting string.


C24 Technologies © 2002-2012: All Rights Reserved.