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 TypeMethodDescriptionSpelPropertyComparator<@Nullable T> asc()Sort ascending.protected StringCreate the expression raw value.intSpelPropertyComparator<@Nullable T> desc()Sort descending.protected SpelExpressionParse values toSpelExpressiongetPath()Get dot path to property.SpelPropertyComparator<@Nullable T> Sort null values first.SpelPropertyComparator<@Nullable T> Sort null values last.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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
-
desc
-
nullsFirst
Sort null values first.- Returns:
-
nullsLast
Sort null values last.- Returns:
-
getExpression
-
buildExpressionForPath
-
compare
- Specified by:
comparein interfaceComparator<T>
-
getPath
-