public class BeanPropertyComparator<T> extends Object implements Comparator<T>
Constructor and Description |
---|
BeanPropertyComparator()
The constructor inits the logger.
|
BeanPropertyComparator(String property)
Creates an BeanPropertyComparator with an property
|
BeanPropertyComparator(String property,
boolean ascending)
Creates an BeanPropertyComparator with an property
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
Object o2)
Compares 2 objects by there Comparable property.
|
String |
getProperty() |
boolean |
isAscending() |
void |
setAscending(boolean ascending) |
void |
setProperty(String property) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public BeanPropertyComparator()
public BeanPropertyComparator(String property)
property
- The property to compare to.public BeanPropertyComparator(String property, boolean ascending)
property
- public int compare(Object o1, Object o2) throws ClassCastException
compare
in interface Comparator<T>
o1
- Object 1o2
- Object 2ClassCastException
public String getProperty()
public void setProperty(String property)
property
- The property to set.public boolean isAscending()
public void setAscending(boolean ascending)
ascending
- The ascending to set.Copyright © 2004-2012 X4O. All Rights Reserved.