public class BeanPropertyComparator extends Object implements Comparator, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BeanPropertyComparator.BeanComparisonException |
Constructor and Description |
---|
BeanPropertyComparator(List propertyNames)
Constructs a PropertyComparator for comparing beans using the properties named in the given List
|
BeanPropertyComparator(List propertyNames,
boolean ignoreCase)
Constructs a PropertyComparator for comparing beans using the properties named in the given List.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
Object o2)
Compare two JavaBeans by the properties given to the constructor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public BeanPropertyComparator(List propertyNames)
if 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.
propertyNames
- List of property names (as Strings) used to compare beanspublic BeanPropertyComparator(List propertyNames, boolean ignoreCase)
Properties will be compared in the order in which they are listed. Case will be ignored if ignoreCase is true.
propertyNames
- List of property names (as Strings) used to compare beansignoreCase
- if true, case will be ignored during String comparisonspublic int compare(Object o1, Object o2)
compare
in interface Comparator
o1
- Object The first bean to get data from to compare againsto2
- Object The second bean to get data from to compareCopyright © 2005–2014 The Kuali Foundation. All rights reserved.