Module spring.data.keyvalue
Class SpelPropertyComparator<T>
java.lang.Object
org.springframework.data.keyvalue.core.SpelPropertyComparator<T>
- Type Parameters:
T-
- All Implemented Interfaces:
Comparator<T>
Comparator implementation using SpelExpression.- Author:
- Christoph Strobl, Oliver Gierke, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionSpelPropertyComparator(String path, SpelExpressionParser parser) Create newSpelPropertyComparatorfor the given property path anSpelExpressionParser. -
Method Summary
Modifier and TypeMethodDescriptionasc()Sort ascending.protected StringCreate the expression raw value.intdesc()Sort descending.protected SpelExpressionParse values toSpelExpressiongetPath()Get dot path to property.Sort null values first.Sort null values last.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
SpelPropertyComparator
Create newSpelPropertyComparatorfor the given property path anSpelExpressionParser.- Parameters:
path- must not be null or empty.parser- must not be null.
-
-
Method Details
-
asc
Sort ascending.- Returns:
-
desc
Sort descending.- Returns:
-
nullsFirst
Sort null values first.- Returns:
-
nullsLast
Sort null values last.- Returns:
-
getExpression
Parse values toSpelExpression- Returns:
-
buildExpressionForPath
Create the expression raw value.- Returns:
-
compare
- Specified by:
comparein interfaceComparator<T>
-
getPath
Get dot path to property.- Returns:
-