org.ejtools.beans
Class Sort

java.lang.Object
  |
  +--org.ejtools.beans.Sort

public class Sort
extends java.lang.Object

Utility class that provides different kind of sort strategies for Iterator.

Version:
$Revision: 1.7 $
Author:
Laurent Etiemble

Method Summary
static java.util.Iterator getChildrenByClass(java.util.Iterator iterator, java.lang.Class clazz)
          Extract the elements of the specified class from the Iterator.
static java.util.Iterator sortByClass(java.util.Iterator iterator)
          Sort the iterator by class name
static java.util.Iterator sortByClassAndName(java.util.Iterator iterator)
          Sort the iterator by class name and by toString method
static java.util.Iterator sortByName(java.util.Iterator iterator)
          Sort the iterator by toString method
static java.util.Iterator sortByProperty(java.util.Iterator iterator, java.lang.Class clazz, java.lang.String propertyName)
          Sort and iterator of JavaBeans by comparing the given property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getChildrenByClass

public static java.util.Iterator getChildrenByClass(java.util.Iterator iterator,
                                                    java.lang.Class clazz)
Extract the elements of the specified class from the Iterator.

Parameters:
iterator - Iterator to scan
clazz - Class used for the extraction
Returns:
The elements of the specified class

sortByClass

public static java.util.Iterator sortByClass(java.util.Iterator iterator)
Sort the iterator by class name

Parameters:
iterator - Iterator to sort
Returns:
The iterator sorted

sortByClassAndName

public static java.util.Iterator sortByClassAndName(java.util.Iterator iterator)
Sort the iterator by class name and by toString method

Parameters:
iterator - Iterator to sort
Returns:
The iterator sorted

sortByName

public static java.util.Iterator sortByName(java.util.Iterator iterator)
Sort the iterator by toString method

Parameters:
iterator - Iterator to sort
Returns:
The iterator sorted

sortByProperty

public static java.util.Iterator sortByProperty(java.util.Iterator iterator,
                                                java.lang.Class clazz,
                                                java.lang.String propertyName)
Sort and iterator of JavaBeans by comparing the given property

Parameters:
iterator - Iterator to sort
clazz - The class of the JavaBean
propertyName - The property used for sorting
Returns:
The iterator sorted


Copyright © 2002-2003 EJTools Org.. All Rights Reserved.