PropertyComparator
public
PropertyComparator(property
:
String, otherProperties
:
String...)
Constructs the comparator from the variable length argument list. The
parameters are property names that are to be used for the comparison.
When comparing two objects, the comparator first compares them by the
first property. If the two objects have equal values for the first
property, the comparator then compares them by the second property,
etc, until one object is determined to be less than the other or they are
equal. Each parameter must be either a simple name like "totalSum" or can
be a reference to a custom attribute like "custom.mytotal". Each
parameter may also be prefixed with an optional '+' or '-' character to
indicate that the objects should be sorted ascending or descending
respectively by that property. If not specified for a given property then
'+' (ascending sort) is assumed.
For example: new PropertyComparator("+prop1", "-prop2", "prop3")
constructs a Comparator which sorts by prop1 ascending, prop2 descending,
and finally prop3 ascending.
The comparator created with this constructor treats null values as
greater than any other value.
Parameters:
property
-
The property name to compare by first.
otherProperties
-
Additional property names to sort by if two objects have the same values for the first property.
PropertyComparator
public
PropertyComparator(propertyName
:
String, sortOrder
:
boolean)
Constructs the comparator. The specified parameter is the name of the
property that is used for the comparison. The parameter must be either a
simple name like "totalSum" or can be a reference to a custom attribute
like "custom.mytotal".
The comparator created with this constructor is setup with ascending or
descending sort order depending on value of sortOrder and null values
being greater than any other value.
Parameters:
propertyName
-
the name of the property that is used for the comparison.
sortOrder
-
the sort order to use where true means ascending and false means descending.
PropertyComparator
public
PropertyComparator(propertyName
:
String, sortOrder
:
boolean, nullGreater
:
boolean)
Constructs the comparator. The specified parameter is the name of the
property that is used for the comparison. The parameter must be either a
simple name like "totalSum" or can be a reference to a custom attribute
like "custom.mytotal".
Parameters:
propertyName
-
the name of the property that is used for the comparison.
sortOrder
-
the sort order to use where true means ascending and false means descending.
nullGreater
-
true means null is greater than any other value