Class ComparableValue

    • Constructor Detail

      • ComparableValue

        public ComparableValue​(java.lang.String attributeName,
                               java.lang.Object value)
        Constructor
        Parameters:
        attributeName - attribute name
        value - comparable value (used to infer type)
      • ComparableValue

        public ComparableValue​(java.lang.String attributeName,
                               AttributeType type)
        Constructor
        Parameters:
        attributeName - attribute name
        type - 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 element
        attributeExtractors - map of attribute extractors to attribute value names
        Returns:
        true if the criteria matches this element
      • executeComparable

        protected abstract boolean executeComparable​(java.lang.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​(java.lang.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​(java.lang.String s1,
                                                 java.lang.String s2)
        Perform a Lucene compatible case insensitive string comparison.
        Parameters:
        s1 - first string
        s2 - second string
        Returns:
        the comparison result