org.ujac.util
Class BeanComparator

java.lang.Object
  extended by org.ujac.util.BeanComparator
All Implemented Interfaces:
Comparator

public class BeanComparator
extends Object
implements Comparator

Name: BeanComparator
Description: Generic comparator for java beans.

Author:
lauerc

Constructor Summary
BeanComparator(CompareTuple compareTuple)
          Constructs a BeanComparator instance with specific attributes.
BeanComparator(CompareTuple[] compareTuples)
          Constructs a BeanComparator instance with specific attributes.
BeanComparator(String fieldName)
          Constructs a BeanComparator instance with specific attributes.
BeanComparator(String[] fieldNames)
          Constructs a BeanComparator instance with specific attributes.
 
Method Summary
 int compare(Object o1, Object o2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

BeanComparator

public BeanComparator(String fieldName)
Constructs a BeanComparator instance with specific attributes.

Parameters:
fieldName - The name of the field by which to sort.

BeanComparator

public BeanComparator(CompareTuple compareTuple)
Constructs a BeanComparator instance with specific attributes.

Parameters:
compareTuple - The name of the field plus the direction by which to sort.

BeanComparator

public BeanComparator(String[] fieldNames)
Constructs a BeanComparator instance with specific attributes.

Parameters:
fieldNames - The names of the fields by which to sort.

BeanComparator

public BeanComparator(CompareTuple[] compareTuples)
Constructs a BeanComparator instance with specific attributes.

Parameters:
compareTuples - The names of the field plus the directions by which to sort.
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator
See Also:
Comparator.compare(java.lang.Object, java.lang.Object)


Copyright © 2003-2004 UJAC.org. All Rights Reserved.