A comparator which compares objects based on one or more bean properties. Nested properties are fully supported. If a property is non-String and implements {@link Comparable} then the{@code compareTo()} method is delegated to. Otherwise the property is converted to a Stringand a {@link Locale} aware {@link Collator} is used to to compare property values.
@author Tim Fennell @since Stripes 1.5This comparator compares two beans by the specified bean property. It is also possible to compare beans based on nested, indexed, combined, mapped bean properties. Please see the {@link PropertyUtilsBean} documentation for all property name possibilities.
Note: The BeanComparator passes the values of the specified bean property to a ComparableComparator, if no comparator is specified in the constructor. If you are comparing two beans based on a property that could contain "null" values, a suitable Comparator
or ComparatorChain
should be supplied in the constructor.
|
|