public class DynamicComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Object>
Known limitations:
compare(Object, Object) method have the same
property and that return type of these properties are the same (so for now this comparator will not work with
covariant return types).| Constructor and Description |
|---|
DynamicComparator(java.lang.String propertyName)
Convienience constructor that is the same as DynamicComparator(propertyName, false);
|
DynamicComparator(java.lang.String propertyName,
boolean reversedOrder)
Creates instance that compares objects by specified javaBean-style property using specified order (normal or
reversed).
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(java.lang.Object object1,
java.lang.Object object2) |
public DynamicComparator(java.lang.String propertyName)
public DynamicComparator(java.lang.String propertyName,
boolean reversedOrder)
propertyName - name of the property that will be used to do comparison. This property must exist on both objects passed
to compare(Object, Object) method and it must return a ReferenceType that implements
java.lang.Comparable (this excludes java primitive types and arrays)reversedOrder - if equals true, the comparison order is reversed. It is normal (so called "natural") order otherwise.Copyright © 2018 SAP SE. All Rights Reserved.