public abstract class ComparableValue extends BaseCriteria
Comparable
valuesModifier and Type | Class and Description |
---|---|
private static class |
ComparableValue.LuceneCaseAgnosticStringComparator
A Lucene compatible case insensitive string comparator.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
attributeName |
private static java.util.Comparator<java.lang.String> |
LUCENE_STRING_COMPARATOR |
private AttributeType |
type |
Constructor and Description |
---|
ComparableValue(java.lang.String attributeName,
AttributeType type)
Constructor
|
ComparableValue(java.lang.String attributeName,
java.lang.Object value)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
execute(Element e,
java.util.Map<java.lang.String,AttributeExtractor> attributeExtractors)
Test this criteria against a cache element
|
protected abstract boolean |
executeComparable(java.lang.Comparable attributeValue)
Execute this criteria for the given
Comparable attribute value |
protected abstract boolean |
executeComparableString(java.lang.Comparable attributeValue)
Execute this criteria for the given
Comparable strin type attribute value |
java.lang.String |
getAttributeName()
Attribute name.
|
AttributeType |
getType()
Attribute type.
|
protected static int |
luceneStringCompare(java.lang.String s1,
java.lang.String s2)
Perform a Lucene compatible case insensitive string comparison.
|
and, getExtractor, not, or
private static final java.util.Comparator<java.lang.String> LUCENE_STRING_COMPARATOR
private final java.lang.String attributeName
private final AttributeType type
public ComparableValue(java.lang.String attributeName, java.lang.Object value)
attributeName
- attribute namevalue
- comparable value (used to infer type)public ComparableValue(java.lang.String attributeName, AttributeType type)
attributeName
- attribute nametype
- the expeceted type for values evaluated by this criteriapublic java.lang.String getAttributeName()
public AttributeType getType()
public boolean execute(Element e, java.util.Map<java.lang.String,AttributeExtractor> attributeExtractors)
e
- cache elementattributeExtractors
- map of attribute extractors to attribute value namesprotected abstract boolean executeComparable(java.lang.Comparable attributeValue)
Comparable
attribute valueattributeValue
- Comparable attribute valueprotected abstract boolean executeComparableString(java.lang.Comparable attributeValue)
Comparable
strin type attribute valueattributeValue
- Comparable attribute valueprotected static int luceneStringCompare(java.lang.String s1, java.lang.String s2)
s1
- first strings2
- second string