biz.c24.io.api.data
Interface RegExpEvaluator

All Known Implementing Classes:
JakartaOroEvaluator, JakartaRegExpEvaluator, JavaPatternEvaluator, XercesRegExpEvaluator

public interface RegExpEvaluator

A simple interface for evaluating Regular expressions.


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.
 

Method Detail

matches

boolean matches(String value)
Returns true if the given String is matched by the regular expression of this 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)

setRegex

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

Parameters:
regex - the regular expression

getRegex

String getRegex()
Returns the regular expression in plain text form.

Returns:
The regular expression.

split

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

Parameters:
value - The value to split.
Returns:
The array of tokens.

replace

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.
This is an optional method - implementations which don't support it will throw an UnsupportedOperationException.

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.