|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.util.JavaBeanPropertyComparator
public final class JavaBeanPropertyComparator
This is a comparator that can be used for in-process sorting of a collection of java beans.
Field Summary | |
---|---|
static int |
ASCENDING
Constant value representing an ascending sort. |
static int |
DESCENDING
Constant value representing a descending sort. |
Constructor Summary | |
---|---|
JavaBeanPropertyComparator(java.lang.String propertyName)
Construct a comparator with sort
order and the given property name. |
|
JavaBeanPropertyComparator(java.lang.String propertyName,
int sortOrder)
Construct a comparator with the given sort order and property name. |
Method Summary | |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
If both o1 and o2 have the
appropriate java bean property, compare the String
representation of that property value on each. |
boolean |
equals(java.lang.Object obj)
Return true if the passed-in obj is the same as
this. |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ASCENDING
public static final int DESCENDING
Constructor Detail |
---|
public JavaBeanPropertyComparator(java.lang.String propertyName)
ASCENDING
sort
order and the given property name.
propertyName
- the name of the property to use for sortingpublic JavaBeanPropertyComparator(java.lang.String propertyName, int sortOrder)
propertyName
- the name of the property to use for sortingsortOrder
- ASCENDING
or DESCENDING
Method Detail |
---|
public int compare(java.lang.Object o1, java.lang.Object o2)
If both o1
and o2
have the
appropriate java bean property, compare the String
representation of that property value on each.
If one of the objects has the property and the other doesn't, the one with the property will be considered "less" than the one without the property. If neither object has the property, 0 will be returned.
If the sort order is DESCENDING
, the value
returned will be negated.
compare
in interface java.util.Comparator
o1
- the first java bean to compareo2
- the second java bean to compare
public boolean equals(java.lang.Object obj)
obj
is the same as
this.
equals
in interface java.util.Comparator
equals
in class java.lang.Object
obj
- the object being tested for equality to this
public static void main(java.lang.String[] args)
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |