spring-framework / org.springframework.beans.support / PropertyComparator

PropertyComparator

open class PropertyComparator<T : Any> : Comparator<T>

PropertyComparator performs a comparison of two beans, evaluating the specified bean property via a BeanWrapper.

Author
Juergen Hoeller

Author
Jean-Pierre Pawlak

Since
19.05.2003

See Also
org.springframework.beans.BeanWrapper

Constructors

<init>

PropertyComparator(sortDefinition: SortDefinition)

Create a new PropertyComparator for the given SortDefinition.

PropertyComparator(property: String, ignoreCase: Boolean, ascending: Boolean)

Create a PropertyComparator for the given settings.

Functions

compare

open fun compare(o1: T, o2: T): Int

getSortDefinition

fun getSortDefinition(): SortDefinition

Return the SortDefinition that this comparator uses.

sort

open static fun sort(source: MutableList<*>, sortDefinition: SortDefinition): Unit

Sort the given List according to the given sort definition.

Note: Contained objects have to provide the given property in the form of a bean property, i.e. a getXXX method.

open static fun sort(source: Array<Any>, sortDefinition: SortDefinition): Unit

Sort the given source according to the given sort definition.

Note: Contained objects have to provide the given property in the form of a bean property, i.e. a getXXX method.