ehcache

net.sf.ehcache.search.expression
Class ComparableValue

java.lang.Object
  extended by net.sf.ehcache.search.expression.BaseCriteria
      extended by 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 involving Comparable values

Author:
teck

Constructor Summary
ComparableValue(String attributeName, AttributeType type)
          Constructor
ComparableValue(String attributeName, Object value)
          Constructor
 
Method Summary
 boolean execute(Element e, Map<String,AttributeExtractor> attributeExtractors)
          Test this criteria against a cache element
protected abstract  boolean executeComparable(Comparable attributeValue)
          Execute this criteria for the given Comparable attribute value
protected abstract  boolean executeComparableString(Comparable attributeValue)
          Execute this criteria for the given Comparable strin type attribute value
 String getAttributeName()
          Attribute name.
 Set<Attribute<?>> getAttributes()
          Returns all search attributes referenced by this instance
 AttributeType getType()
          Attribute type.
protected static int luceneStringCompare(String s1, String s2)
          Perform a Lucene compatible case insensitive string comparison.
 
Methods inherited from class net.sf.ehcache.search.expression.BaseCriteria
and, getExtractor, not, or
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparableValue

public ComparableValue(String attributeName,
                       Object value)
Constructor

Parameters:
attributeName - attribute name
value - comparable value (used to infer type)

ComparableValue

public ComparableValue(String attributeName,
                       AttributeType type)
Constructor

Parameters:
attributeName - attribute name
type - the expeceted type for values evaluated by this criteria
Method Detail

getAttributeName

public String getAttributeName()
Attribute name.

Returns:
name

getType

public AttributeType getType()
Attribute type.

Returns:
type

execute

public boolean execute(Element e,
                       Map<String,AttributeExtractor> attributeExtractors)
Test this criteria against a cache element

Parameters:
e - cache element
attributeExtractors - map of attribute extractors to attribute value names
Returns:
true if the criteria matches this element

getAttributes

public Set<Attribute<?>> getAttributes()
Description copied from class: BaseCriteria
Returns all search attributes referenced by this instance

Specified by:
getAttributes in class BaseCriteria

executeComparable

protected abstract boolean executeComparable(Comparable attributeValue)
Execute this criteria for the given Comparable attribute value

Parameters:
attributeValue - Comparable attribute value
Returns:
true if criteria is met

executeComparableString

protected abstract boolean executeComparableString(Comparable attributeValue)
Execute this criteria for the given Comparable strin type attribute value

Parameters:
attributeValue - Comparable attribute value
Returns:
true if criteria is met

luceneStringCompare

protected static int luceneStringCompare(String s1,
                                         String s2)
Perform a Lucene compatible case insensitive string comparison.

Parameters:
s1 - first string
s2 - second string
Returns:
the comparison result

ehcache

Copyright 2001-2015, Terracotta, Inc.