com.softwareag.centrasite.appl.framework.persistence.search
Class Predicates

java.lang.Object
  extended by com.softwareag.centrasite.appl.framework.persistence.search.Predicates

public class Predicates
extends java.lang.Object

The search package may be used by applications as a framework for building new kinds of Predicate types. However, it is intended that most applications will simply use the built-in criterion types via the static factory methods of this class.

The simple predicates created by the factory methods of this class require a property name. This name always has to start with a lowercase character. For example if the property's getter method in the bean interface is getIDOfTarget() then the property name for the predicate is iDOfTarget.


Constructor Summary
Predicates()
           
 
Method Summary
static Predicate and(Predicate p1, Predicate p2)
          Create a predicate which is logical conjunctions of the given predicates.
static Predicate eq(java.lang.String propertyName, java.lang.Object value)
          Create a "equals" predicate, the beanType is the one given to the search object.
static Predicate eq(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "equals" predicate for a given beanType.
static Predicate ge(java.lang.String propertyName, java.lang.Object value)
          Create a "greater or equals" predicate.
static Predicate ge(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "greater or equals" predicate for a given beanType.
static Predicate gt(java.lang.String propertyName, java.lang.Object value)
          Create a "greater then" predicate.
static Predicate gt(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "greater then" predicate for a given beanType.
static Predicate le(java.lang.String propertyName, java.lang.Object value)
          Create a "less or equals" predicate.
static Predicate le(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "less or equals" predicate for a given beanType.
static Predicate like(java.lang.String propertyName, java.lang.String value)
          Create a "like" predicate.
static Predicate like(java.lang.String propertyName, java.lang.String value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "like" predicate for a given beanType.
static Predicate lt(java.lang.String propertyName, java.lang.Object value)
          Create a "less then" predicate.
static Predicate lt(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "less then" predicate for a given beanType.
static Predicate lt(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType, Search search)
          Deprecated. instead use lt(propertyName, value, beanType)
static Predicate ne(java.lang.String propertyName, java.lang.Object value)
          Create a "non equal" predicate.
static Predicate ne(java.lang.String propertyName, java.lang.Object value, java.lang.Class<? extends RegistryBean> beanType)
          Create a "non equal" predicate for a given beanType.
static Predicate or(Predicate p1, Predicate p2)
          Create a predicate which is logical disjunctions of the given predicates.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Predicates

public Predicates()
Method Detail

like

public static Predicate like(java.lang.String propertyName,
                             java.lang.String value,
                             java.lang.Class<? extends RegistryBean> beanType)
Create a "like" predicate for a given beanType. Can be used only on String values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

like

public static Predicate like(java.lang.String propertyName,
                             java.lang.String value)
Create a "like" predicate. Can be used only on String values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

gt

public static Predicate gt(java.lang.String propertyName,
                           java.lang.Object value)
Create a "greater then" predicate. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

gt

public static Predicate gt(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType)
Create a "greater then" predicate for a given beanType. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
beanType - the bean type
Returns:
predicate the predicate

lt

public static Predicate lt(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType,
                           Search search)
Deprecated. instead use lt(propertyName, value, beanType)

Create a "less then" predicate for a given beanType. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
beanType - the bean type
Returns:
predicate the predicate

lt

public static Predicate lt(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType)
Create a "less then" predicate for a given beanType. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
beanType - the bean type
Returns:
predicate the predicate

lt

public static Predicate lt(java.lang.String propertyName,
                           java.lang.Object value)
Create a "less then" predicate. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

ge

public static Predicate ge(java.lang.String propertyName,
                           java.lang.Object value)
Create a "greater or equals" predicate. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

ge

public static Predicate ge(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType)
Create a "greater or equals" predicate for a given beanType. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
beanType - the bean type
Returns:
predicate the predicate

le

public static Predicate le(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType)
Create a "less or equals" predicate for a given beanType. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
beanType - the bean type
Returns:
predicate the predicate

le

public static Predicate le(java.lang.String propertyName,
                           java.lang.Object value)
Create a "less or equals" predicate. Can be used only on Number, Date or Calendar object values

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

eq

public static Predicate eq(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType)
                    throws CSAppFrameworkException
Create a "equals" predicate for a given beanType.

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
beanType - the bean type
Returns:
predicate the predicate
Throws:
CSAppFrameworkException

eq

public static Predicate eq(java.lang.String propertyName,
                           java.lang.Object value)
                    throws CSAppFrameworkException
Create a "equals" predicate, the beanType is the one given to the search object.

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate
Throws:
CSAppFrameworkException

ne

public static Predicate ne(java.lang.String propertyName,
                           java.lang.Object value,
                           java.lang.Class<? extends RegistryBean> beanType)
Create a "non equal" predicate for a given beanType.

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

ne

public static Predicate ne(java.lang.String propertyName,
                           java.lang.Object value)
Create a "non equal" predicate.

Parameters:
propertyName - the property name, with the first character in lowercase
value - the comparison value
Returns:
predicate the predicate

and

public static Predicate and(Predicate p1,
                            Predicate p2)
Create a predicate which is logical conjunctions of the given predicates.

Parameters:
p1 -
p2 -
Returns:
predicate the predicate

or

public static Predicate or(Predicate p1,
                           Predicate p2)
Create a predicate which is logical disjunctions of the given predicates.

Parameters:
p1 -
p2 -
Returns:
predicate the predicate