Package org.kuali.rice.krad.util
Class BeanPropertyComparator
java.lang.Object
org.kuali.rice.krad.util.BeanPropertyComparator
- All Implemented Interfaces:
Serializable,Comparator
BeanPropertyComparator compares the two beans using multiple property names
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionBeanPropertyComparator(List propertyNames) Constructs a PropertyComparator for comparing beans using the properties named in the given ListBeanPropertyComparator(List propertyNames, boolean ignoreCase) Constructs a PropertyComparator for comparing beans using the properties named in the given List. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
BeanPropertyComparator
Constructs a PropertyComparator for comparing beans using the properties named in the given Listif the List is null, the beans will be compared directly by Properties will be compared in the order in which they are listed. Case will be ignored in String comparisons.
- Parameters:
propertyNames- List of property names (as Strings) used to compare beans
-
BeanPropertyComparator
Constructs a PropertyComparator for comparing beans using the properties named in the given List.Properties will be compared in the order in which they are listed. Case will be ignored if ignoreCase is true.
- Parameters:
propertyNames- List of property names (as Strings) used to compare beansignoreCase- if true, case will be ignored during String comparisons
-
-
Method Details
-
compare
Compare two JavaBeans by the properties given to the constructor.- Specified by:
comparein interfaceComparator- Parameters:
o1- Object The first bean to get data from to compare againsto2- Object The second bean to get data from to compare- Returns:
- int negative or positive based on order
-