biz.c24.io.api.data
Class JakartaOroEvaluator

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

public class JakartaOroEvaluator
extends Object
implements RegExpEvaluator

An implementation of the RegExpEvaluator that uses the Jakarta ORO Regular Expression library. Please ensure that this library added to your classpath (jakarta-oro-2.0.8.jar or later version). For more information about the Jakarta ORO library please visit: http://jakarta.apache.org/oro/


Field Summary
static int AWK_COMPILE
          Flag used to specify that the regular expression should be interpreted in AWK style.
static int GLOB_COMPILE
          Flag used to specify that the regular expression should be interpreted in GLOB style.
static int PERL5_COMPILE
          Flag used to specify that the regular expression should be interpreted in PERL5 style.
 
Constructor Summary
JakartaOroEvaluator()
          Creates a new instance.
JakartaOroEvaluator(String regex, int regexType)
          Creates a new instance with the specified regex and type.
 
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
 

Field Detail

AWK_COMPILE

public static final int AWK_COMPILE
Flag used to specify that the regular expression should be interpreted in AWK style.

See Also:
Constant Field Values

GLOB_COMPILE

public static final int GLOB_COMPILE
Flag used to specify that the regular expression should be interpreted in GLOB style.

See Also:
Constant Field Values

PERL5_COMPILE

public static final int PERL5_COMPILE
Flag used to specify that the regular expression should be interpreted in PERL5 style.

See Also:
Constant Field Values
Constructor Detail

JakartaOroEvaluator

public JakartaOroEvaluator()
Creates a new instance.


JakartaOroEvaluator

public JakartaOroEvaluator(String regex,
                           int regexType)
Creates a new instance with the specified regex and type.

Parameters:
regex - The regular expression.
regexType - The type of the regular expression (one of AWK_COMPILE, GLOB_COMPILE or PERL5_COMPILE).
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.