ehcache

net.sf.ehcache.search
Class Attribute<T>

java.lang.Object
  extended by net.sf.ehcache.search.Attribute<T>
Type Parameters:
T - the parameterize type of this attribute

public class Attribute<T>
extends Object

A search attribute. The main purpose of this class is to construct search Criteria referencing this attribute

Author:
teck

Constructor Summary
Attribute(String attributeName)
          Construct a new attribute instance.
 
Method Summary
 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(Object obj)
          
 Criteria ge(T value)
          Create a criteria where this attribute is greater than or equal to the given value
 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(String regex)
          Create a criteria where this attribute's toString() matches the given expression See ILike for the expression syntax
 Criteria in(Collection<? extends T> values)
          Create a criteria where this attribute is 'in' (ie.
 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
 Aggregator sum()
          Request a sum aggregation of this attribute
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attribute

public Attribute(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 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(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(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

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 String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

ehcache

Copyright 2001-2014, Terracotta, Inc.