Package net.sf.ehcache.search.expression
Class ComparableValue
- java.lang.Object
-
- net.sf.ehcache.search.expression.BaseCriteria
-
- net.sf.ehcache.search.expression.ComparableValue
-
- All Implemented Interfaces:
Criteria
- Direct Known Subclasses:
Between,GreaterThan,GreaterThanOrEqual,LessThan,LessThanOrEqual
public abstract class ComparableValue extends BaseCriteria
Abstract base class for criteria involvingComparablevalues- Author:
- teck
-
-
Constructor Summary
Constructors Constructor Description ComparableValue(java.lang.String attributeName, java.lang.Object value)ConstructorComparableValue(java.lang.String attributeName, AttributeType type)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanexecute(Element e, java.util.Map<java.lang.String,AttributeExtractor> attributeExtractors)Test this criteria against a cache elementprotected abstract booleanexecuteComparable(java.lang.Comparable attributeValue)Execute this criteria for the givenComparableattribute valueprotected abstract booleanexecuteComparableString(java.lang.Comparable attributeValue)Execute this criteria for the givenComparablestrin type attribute valuejava.lang.StringgetAttributeName()Attribute name.java.util.Set<Attribute<?>>getAttributes()Returns all search attributes referenced by this instanceAttributeTypegetType()Attribute type.protected static intluceneStringCompare(java.lang.String s1, java.lang.String s2)Perform a Lucene compatible case insensitive string comparison.-
Methods inherited from class net.sf.ehcache.search.expression.BaseCriteria
and, getExtractor, not, or
-
-
-
-
Constructor Detail
-
ComparableValue
public ComparableValue(java.lang.String attributeName, java.lang.Object value)Constructor- Parameters:
attributeName- attribute namevalue- comparable value (used to infer type)
-
ComparableValue
public ComparableValue(java.lang.String attributeName, AttributeType type)Constructor- Parameters:
attributeName- attribute nametype- the expeceted type for values evaluated by this criteria
-
-
Method Detail
-
getAttributeName
public java.lang.String getAttributeName()
Attribute name.- Returns:
- name
-
getType
public AttributeType getType()
Attribute type.- Returns:
- type
-
execute
public boolean execute(Element e, java.util.Map<java.lang.String,AttributeExtractor> attributeExtractors)
Test this criteria against a cache element- Parameters:
e- cache elementattributeExtractors- map of attribute extractors to attribute value names- Returns:
- true if the criteria matches this element
-
getAttributes
public java.util.Set<Attribute<?>> getAttributes()
Description copied from class:BaseCriteriaReturns all search attributes referenced by this instance- Specified by:
getAttributesin classBaseCriteria
-
executeComparable
protected abstract boolean executeComparable(java.lang.Comparable attributeValue)
Execute this criteria for the givenComparableattribute value- Parameters:
attributeValue- Comparable attribute value- Returns:
- true if criteria is met
-
executeComparableString
protected abstract boolean executeComparableString(java.lang.Comparable attributeValue)
Execute this criteria for the givenComparablestrin type attribute value- Parameters:
attributeValue- Comparable attribute value- Returns:
- true if criteria is met
-
luceneStringCompare
protected static int luceneStringCompare(java.lang.String s1, java.lang.String s2)Perform a Lucene compatible case insensitive string comparison.- Parameters:
s1- first strings2- second string- Returns:
- the comparison result
-
-