|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.norther.tammi.acorn.util.PropertyComparator
public class PropertyComparator
A comparator for properties.
Constructor Summary | |
---|---|
PropertyComparator(String prop)
Constructs a new comparator. |
|
PropertyComparator(String[] props)
Constructs a new comparator for multiple properties. |
|
PropertyComparator(String[] props,
Comparator<?> comp)
Constructs a new comparator for multiple properties with a value comparator. |
|
PropertyComparator(String prop,
Comparator<?> comp)
Constructs a new comparator with a value comparator. |
Method Summary | |
---|---|
int |
compare(Object obj1,
Object obj2)
|
protected int |
compare(Object var1,
Object var2,
String prop)
Compares the specified property of two objects in ascending order. |
protected Object |
getNestedProperty(Object obj,
String prop)
Gets the optionally nested property value. |
protected Object |
getProperty(Object obj,
String prop)
Gets the named property value. |
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 |
---|
public PropertyComparator(String prop)
prop
- the property to compare.public PropertyComparator(String prop, Comparator<?> comp)
prop
- the property to compare.comp
- the property value comparator.public PropertyComparator(String[] props)
props
- the properties to compare.public PropertyComparator(String[] props, Comparator<?> comp)
props
- the properties to compare.comp
- the property value comparator.Method Detail |
---|
public int compare(Object obj1, Object obj2)
compare
in interface Comparator<Object>
protected int compare(Object var1, Object var2, String prop)
var1
- the first object to be compared.var2
- the second object to be compared.prop
- the name of the property.
protected Object getNestedProperty(Object obj, String prop) throws Exception
obj
- the object.prop
- the property.
Exception
- on errors.protected Object getProperty(Object obj, String prop) throws Exception
obj
- the object.prop
- the property.
Exception
- on errors.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |