Class Attribute<T>

  • Type Parameters:
    T - the parameterize type of this attribute

    public class Attribute<T>
    extends java.lang.Object
    A search attribute. The main purpose of this class is to construct search Criteria referencing this attribute
    Author:
    teck
    • Constructor Summary

      Constructors 
      Constructor Description
      Attribute​(java.lang.String attributeName)
      Construct a new attribute instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Aggregator average()
      Request an average value aggregation of this attribute
      Criteria between​(T min, T max)
      Create a range criteria between the given min/max (inclusive).
      Criteria between​(T min, T max, boolean minInclusive, boolean maxInclusive)
      Create a range criteria between the given min/max with specified inclusiveness
      Aggregator count()
      Request a count aggregation of this attribute
      Criteria eq​(T value)
      Create a criteria where this attribute is equal to the given value
      boolean equals​(java.lang.Object obj)
      Criteria ge​(T value)
      Create a criteria where this attribute is greater than or equal to the given value
      java.lang.String getAttributeName()
      Get the attribute name
      Criteria gt​(T value)
      Create a criteria where this attribute is greater than the given value
      int hashCode()
      Criteria ilike​(java.lang.String regex)
      Create a criteria where this attribute's toString() matches the given expression See ILike for the expression syntax
      Criteria in​(java.util.Collection<? extends T> values)
      Create a criteria where this attribute is 'in' (ie.
      Criteria isNull()
      Create a criteria that requires no value for this attribute
      Criteria le​(T value)
      Create a criteria where this attribute is less than or equal to the given value
      Criteria lt​(T value)
      Create a criteria where this attribute is less than the given value
      Aggregator max()
      Request a maximum value aggregation of this attribute
      Aggregator min()
      Request a minimum value aggregation of this attribute
      Criteria ne​(T value)
      Create a criteria where this attribute is not equal to the given value
      Criteria notIlike​(java.lang.String regex)
      Create a criteria where this attribute's toString() does not match the given expression See ILike for the expression syntax
      Criteria notNull()
      Create a criteria that accepts any non-null value for this attribute
      Aggregator sum()
      Request a sum aggregation of this attribute
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Attribute

        public Attribute​(java.lang.String attributeName)
        Construct a new attribute instance. Instances are normally obtained from a specific Cache however
        Parameters:
        attributeName - the name of search attribute
    • Method Detail

      • getAttributeName

        public java.lang.String getAttributeName()
        Get the attribute name
        Returns:
        the attribute name
      • between

        public Criteria between​(T min,
                                T max)
        Create a range criteria between the given min/max (inclusive). This is the same as calling between(min, max, true, true)
        Parameters:
        min - the minimum value in the range
        max - the maximum value in the range
        Returns:
        criteria instance
      • between

        public Criteria between​(T min,
                                T max,
                                boolean minInclusive,
                                boolean maxInclusive)
        Create a range criteria between the given min/max with specified inclusiveness
        Parameters:
        min - the minimum value in the range
        max - the maximum value in the range
        minInclusive - is the minimum inclusive in the range
        maxInclusive - is the maximum inclusive in the range
        Returns:
        criteria instance
      • in

        public Criteria in​(java.util.Collection<? extends T> values)
        Create a criteria where this attribute is 'in' (ie. contained within) the given collection of values. With the exception of very small collections a Set should perform better here to get constant time contains() checks
        Parameters:
        values -
        Returns:
        criteria instance
      • ne

        public Criteria ne​(T value)
        Create a criteria where this attribute is not equal to the given value
        Parameters:
        value -
        Returns:
        criteria instance
      • lt

        public Criteria lt​(T value)
        Create a criteria where this attribute is less than the given value
        Parameters:
        value -
        Returns:
        criteria instance
      • le

        public Criteria le​(T value)
        Create a criteria where this attribute is less than or equal to the given value
        Parameters:
        value -
        Returns:
        criteria instance
      • gt

        public Criteria gt​(T value)
        Create a criteria where this attribute is greater than the given value
        Parameters:
        value -
        Returns:
        criteria instance
      • ge

        public Criteria ge​(T value)
        Create a criteria where this attribute is greater than or equal to the given value
        Parameters:
        value -
        Returns:
        criteria instance
      • eq

        public Criteria eq​(T value)
        Create a criteria where this attribute is equal to the given value
        Parameters:
        value -
        Returns:
        criteria instance
      • ilike

        public Criteria ilike​(java.lang.String regex)
        Create a criteria where this attribute's toString() matches the given expression See ILike for the expression syntax
        Parameters:
        regex -
        Returns:
        criteria instance
      • notIlike

        public Criteria notIlike​(java.lang.String regex)
        Create a criteria where this attribute's toString() does not match the given expression See ILike for the expression syntax
        Parameters:
        regex -
        Returns:
        criteria instance
      • isNull

        public Criteria isNull()
        Create a criteria that requires no value for this attribute
        Returns:
        criteria instance
      • notNull

        public Criteria notNull()
        Create a criteria that accepts any non-null value for this attribute
        Returns:
        criteria instance
      • count

        public Aggregator count()
        Request a count aggregation of this attribute
        Returns:
        count aggregator
      • max

        public Aggregator max()
        Request a maximum value aggregation of this attribute
        Returns:
        max aggregator
      • min

        public Aggregator min()
        Request a minimum value aggregation of this attribute
        Returns:
        min aggregator
      • sum

        public Aggregator sum()
        Request a sum aggregation of this attribute
        Returns:
        sum aggregator
      • average

        public Aggregator average()
        Request an average value aggregation of this attribute
        Returns:
        average aggregator
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object