org.ujoframework.criterion
Class CriteriaTool<UJO extends Ujo>

java.lang.Object
  extended by org.ujoframework.criterion.CriteriaTool<UJO>

public class CriteriaTool<UJO extends Ujo>
extends java.lang.Object

The Criteria class is a simple tool to search UJO objects in the list. This class takes full advantage of architecture UJO objects. See the next sample.

 Person child  = new Person("Pavel", 140.0);
 Person mother = new Person("Mary", 150.0);
 Person father = new Person("John", 160.0);

 child.set(MOTHER, mother);
 child.set(FATHER, father);

 List<Person> persons = Arrays.asList(child, mother, father);

 Criterion<Person> exp = Criterion.where(NAME, "John");
 UjoComparator<Person> sort = UjoComparator.create(HIGH, NAME);
 List<Person> result = CriteriaTool.where().select(persons, exp, sort);

Since:
0.90
Author:
Pavel Ponec

Constructor Summary
CriteriaTool()
           
 
Method Summary
 UJO findFirst(java.util.List<UJO> list, Criterion<UJO> criterion)
          Find the first UJO by an criterion or return NULL if any object was not found.
static
<UJO extends Ujo>
CriteriaTool<UJO>
newInstance()
          Create a new instance
 java.util.List<UJO> select(java.util.List<UJO> list, Criterion<UJO> criterion)
          Create a sublist of a list by an Ujo criterion.
 java.util.List<UJO> select(java.util.List<UJO> list, Criterion<UJO> criterion, UjoComparator sorting)
          Create a sublist of a list by an Ujo criterion.
 java.util.List<UJO> select(java.util.List<UJO> list, UjoComparator comparator)
          Create a copy of the list and sort it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CriteriaTool

public CriteriaTool()
Method Detail

findFirst

public UJO findFirst(java.util.List<UJO> list,
                     Criterion<UJO> criterion)
Find the first UJO by an criterion or return NULL if any object was not found.


select

public java.util.List<UJO> select(java.util.List<UJO> list,
                                  UjoComparator comparator)
Create a copy of the list and sort it.


select

public java.util.List<UJO> select(java.util.List<UJO> list,
                                  Criterion<UJO> criterion)
Create a sublist of a list by an Ujo criterion.


select

public java.util.List<UJO> select(java.util.List<UJO> list,
                                  Criterion<UJO> criterion,
                                  UjoComparator sorting)
Create a sublist of a list by an Ujo criterion.


newInstance

public static <UJO extends Ujo> CriteriaTool<UJO> newInstance()
Create a new instance



Copyright © 2010. All Rights Reserved.