Expresso 5-6

com.jcorporate.expresso.core.dataobjects.jdbc
Class FieldRangeParser

java.lang.Object
  extended bycom.jcorporate.expresso.core.dataobjects.jdbc.FieldRangeParser

public class FieldRangeParser
extends Object

The responsibilities of this class is to verify range values for fields and throw an exception if there is any 'monkeybusiness' detected in the field.

The parser does not allow everything a normal SQL query would allows due to parsing complexity. However, it will allow multiple conditions, and ranges for BETWEEN and IN.

Accepted Range Strings:

Known bugs with Range issues:

Instances of FieldRangeParser are meant to use shared between threads

Version:
2.0
Author:
Michael Rimov

Constructor Summary
FieldRangeParser()
          Default constructor.
 
Method Summary
 String denotesRange(String fieldValue)
          Does a given field value denote a range?
static FieldRangeParser getInstance()
          Retrieve an instance of the field range parser.
protected  org.apache.oro.text.regex.PatternMatcher getMatcher()
          Retrieves an instance of a perl5 pattern matcher that is thread local to be thread safe.
 boolean isValidRange(DataFieldMetaData metadata, String fieldValue)
          Performs some basic checks to validate the syntax of the range field value given the system to help protect against nasty things like sql injection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldRangeParser

public FieldRangeParser()
Default constructor. This creates all the regular expression matchers, etc.

Method Detail

getMatcher

protected org.apache.oro.text.regex.PatternMatcher getMatcher()
Retrieves an instance of a perl5 pattern matcher that is thread local to be thread safe.

Returns:
PatternMatcher instance.

getInstance

public static FieldRangeParser getInstance()
Retrieve an instance of the field range parser.

Returns:
FieldRangeParser instance

isValidRange

public boolean isValidRange(DataFieldMetaData metadata,
                            String fieldValue)
Performs some basic checks to validate the syntax of the range field value given the system to help protect against nasty things like sql injection

Parameters:
metadata - the field metadata to be checking against.
fieldValue - the field value to check
Returns:
false if the range is invalid.

denotesRange

public String denotesRange(String fieldValue)
Does a given field value denote a range?

Parameters:
fieldValue - The field value to check against.
Returns:
The "range" string if the value starts with a range indicator, null if not

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.