|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujoframework.criterion.Criterion<UJO>
public abstract class Criterion<UJO extends Ujo>
An abstract immutable criterion provides a basic interface and static factory methods. You can use it:
// Make a criterion: Criterion<Person> crn1, crn2, criterion; crn1 = Criterion.where(CASH, Operator.GT, 10.0); crn2 = Criterion.where(CASH, Operator.LE, 20.0); criterion = crn1.and(crn2); // Use a criterion (1): CriteriaTool<Person> ct = CriteriaTool.where(); List<Person> result = ct.select(persons, criterion); assertEquals(1, result.size()); assertEquals(20.0, CASH.of(result.get(0))); // Use a criterion (2): Person person = result.get(0); boolean validation = criterion.evaluate(person); assertTrue(validation);
// Consider instances: Criterion<Person> a, b, c, result; a = Criterion.where(CASH, Operator.GT, 10.0); b = Criterion.where(CASH, Operator.LE, 20.0); c = Criterion.where(NAME, Operator.STARTS, "P"); // Expression #1: (a OR b) AND c : result = (a.or(b)).and(c); // or simply: result = a.or(b).and(c); // Expression #2: a AND (b OR c) : result = a.and(b.or(c));
| Constructor Summary | |
|---|---|
Criterion()
|
|
| Method Summary | ||
|---|---|---|
Criterion<UJO> |
and(Criterion<UJO> criterion)
|
|
static
|
constant(UjoProperty<UJO,?> property,
boolean constant)
This is a special constant criterion independed on the property or the ujo entity. |
|
abstract boolean |
evaluate(UJO ujo)
|
|
abstract java.lang.Object |
getLeftNode()
Returns the left node of the parrent |
|
abstract AbstractOperator |
getOperator()
Returns an operator |
|
abstract java.lang.Object |
getRightNode()
Returns the right node of the parrent |
|
boolean |
isBinary()
Is the class a Binary criterion? |
|
Criterion<UJO> |
join(BinaryOperator operator,
Criterion<UJO> criterion)
|
|
static
|
newInstance(boolean value)
Deprecated. See the where(...) method. |
|
static
|
newInstance(UjoProperty<UJO,TYPE> property,
Operator operator,
TYPE value)
Deprecated. See the where(...) method. |
|
static
|
newInstance(UjoProperty<UJO,TYPE> property,
Operator operator,
UjoProperty<?,TYPE> value)
Deprecated. See the where(...) method. |
|
static
|
newInstance(UjoProperty<UJO,TYPE> property,
TYPE value)
Deprecated. See the where(...) method. |
|
static
|
newInstance(UjoProperty<UJO,TYPE> property,
UjoProperty<UJO,TYPE> value)
Deprecated. See the where(...) method. |
|
static
|
newInstanceFalse(UjoProperty<UJO,?> property)
Deprecated. See the where(...) method. |
|
static
|
newInstanceTrue(UjoProperty<UJO,?> property)
Deprecated. See the where(...) method. |
|
Criterion<UJO> |
not()
|
|
Criterion<UJO> |
or(Criterion<UJO> criterion)
|
|
static
|
where(boolean value)
This is an constane criterion independed on an entity. |
|
static
|
where(UjoProperty<UJO,TYPE> property,
Operator operator,
TYPE value)
New criterion instance |
|
static
|
where(UjoProperty<UJO,TYPE> property,
Operator operator,
UjoProperty<?,TYPE> value)
New criterion instance |
|
static
|
where(UjoProperty<UJO,TYPE> property,
TYPE value)
New equals instance |
|
static
|
where(UjoProperty<UJO,TYPE> property,
UjoProperty<UJO,TYPE> value)
New equals instance |
|
static
|
whereIn(UjoProperty<UJO,TYPE> property,
java.util.Collection<TYPE> list)
Create new Criterion for operator IN to compare value to a list of constants. |
|
static
|
whereIn(UjoProperty<UJO,TYPE> property,
TYPE... list)
Create new Criterion for operator IN to compare value to a list of constants |
|
static
|
whereNotIn(UjoProperty<UJO,TYPE> property,
java.util.Collection<TYPE> list)
Create new Criterion for operator IN to compare value to a list of constants. |
|
static
|
whereNotIn(UjoProperty<UJO,TYPE> property,
TYPE... list)
Create new Criterion for operator IN to compare value to a list of constants. |
|
static
|
whereNotNull(UjoProperty<UJO,TYPE> property)
Criterion where property not equals to NULL. |
|
static
|
whereNull(UjoProperty<UJO,TYPE> property)
Criterion where property equals to NULL. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Criterion()
| Method Detail |
|---|
public abstract boolean evaluate(UJO ujo)
public Criterion<UJO> join(BinaryOperator operator,
Criterion<UJO> criterion)
public Criterion<UJO> and(Criterion<UJO> criterion)
public Criterion<UJO> or(Criterion<UJO> criterion)
public Criterion<UJO> not()
public abstract java.lang.Object getLeftNode()
public abstract java.lang.Object getRightNode()
public abstract AbstractOperator getOperator()
public boolean isBinary()
public static <UJO extends Ujo,TYPE> Criterion<UJO> where(UjoProperty<UJO,TYPE> property,
Operator operator,
TYPE value)
property - UjoPropertyoperator - Operator
public static <UJO extends Ujo,TYPE> Criterion<UJO> where(UjoProperty<UJO,TYPE> property,
Operator operator,
UjoProperty<?,TYPE> value)
property - UjoPropertyoperator - Operator
public static <UJO extends Ujo,TYPE> Criterion<UJO> where(UjoProperty<UJO,TYPE> property,
TYPE value)
property - UjoProperty
public static <UJO extends Ujo,TYPE> Criterion<UJO> whereIn(UjoProperty<UJO,TYPE> property,
java.util.Collection<TYPE> list)
property - A direct or indeirect Ujo propertylist - A collection of the values. The collection argument can be the EMPTY, the Criterion result will be FALSE in this case.
public static <UJO extends Ujo,TYPE> Criterion<UJO> whereNotIn(UjoProperty<UJO,TYPE> property,
java.util.Collection<TYPE> list)
property - A direct or indeirect Ujo propertylist - A collection of the values. The collection argument can be the EMPTY, the Criterion result will be TRUE in this case.
public static <UJO extends Ujo,TYPE> Criterion<UJO> whereIn(UjoProperty<UJO,TYPE> property,
TYPE... list)
property - A reference to a related entitylist - A collection of the values. The collection argument can be the EMPTY, the Criterion result will be FALSE in this case.
public static <UJO extends Ujo,TYPE> Criterion<UJO> whereNotIn(UjoProperty<UJO,TYPE> property,
TYPE... list)
A - property direct or indeirect Ujo propertylist - A collection of the values. The collection argument can be the EMPTY, the Criterion result will be TRUE in this case.
public static <UJO extends Ujo,TYPE> Criterion<UJO> where(UjoProperty<UJO,TYPE> property,
UjoProperty<UJO,TYPE> value)
property - UjoPropertyvalue - Value or UjoProperty can be type a direct of indirect (for a relation) property
public static <UJO extends Ujo,TYPE> Criterion<UJO> whereNull(UjoProperty<UJO,TYPE> property)
property - UjoPropertypublic static <UJO extends Ujo,TYPE> Criterion<UJO> whereNotNull(UjoProperty<UJO,TYPE> property)
property - UjoPropertypublic static <UJO extends Ujo> Criterion<UJO> where(boolean value)
public static <UJO extends Ujo> Criterion<UJO> constant(UjoProperty<UJO,?> property,
boolean constant)
Operator#X_FIXED
@Deprecated
public static <UJO extends Ujo,TYPE> Criterion<UJO> newInstance(UjoProperty<UJO,TYPE> property,
Operator operator,
TYPE value)
where(...) method.
property - UjoPropertyoperator - Operator
@Deprecated
public static <UJO extends Ujo,TYPE> Criterion<UJO> newInstance(UjoProperty<UJO,TYPE> property,
Operator operator,
UjoProperty<?,TYPE> value)
where(...) method.
property - UjoPropertyoperator - Operator
@Deprecated
public static <UJO extends Ujo,TYPE> Criterion<UJO> newInstance(UjoProperty<UJO,TYPE> property,
TYPE value)
where(...) method.
property - UjoProperty
@Deprecated
public static <UJO extends Ujo,TYPE> Criterion<UJO> newInstance(UjoProperty<UJO,TYPE> property,
UjoProperty<UJO,TYPE> value)
where(...) method.
property - UjoPropertyvalue - Value or UjoProperty can be type a direct of indirect (for a relation) property
@Deprecated public static <UJO extends Ujo> Criterion<UJO> newInstance(boolean value)
where(...) method.
@Deprecated public static <UJO extends Ujo> Criterion<UJO> newInstanceTrue(UjoProperty<UJO,?> property)
where(...) method.
@Deprecated public static <UJO extends Ujo> Criterion<UJO> newInstanceFalse(UjoProperty<UJO,?> property)
where(...) method.
UJO - property -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||