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
ConstructorDescriptionSpelPropertyComparator
(String path, SpelExpressionParser parser) Create newSpelPropertyComparator
for the given property path anSpelExpressionParser
. -
Method Summary
Modifier and TypeMethodDescriptionasc()
Sort ascending.protected String
Create the expression raw value.int
desc()
Sort descending.protected SpelExpression
Parse values toSpelExpression
getPath()
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, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
SpelPropertyComparator
Create newSpelPropertyComparator
for 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:
compare
in interfaceComparator<T>
-
getPath
Get dot path to property.- Returns:
-