public class JsonPropertySorter extends Object implements Comparator<MemberScope<?,?>>
JsonPropertyOrder annotation on the declaring type.| Constructor and Description |
|---|
JsonPropertySorter(boolean sortAlphabeticallyIfNotAnnotated)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(MemberScope<?,?> first,
MemberScope<?,?> second) |
protected int |
getPropertyIndex(MemberScope<?,?> property)
Determine the given property's position in its declaring type's schema based on a
JsonPropertyOrder annotation. |
protected boolean |
shouldSortPropertiesAlphabetically(Class<?> declaringType)
Determine whether the given type's properties that are not specifically mentioned in a
JsonPropertyOrder annotation should be sorted
alphabetically, based on JsonPropertyOrder.alphabetic(). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic JsonPropertySorter(boolean sortAlphabeticallyIfNotAnnotated)
sortAlphabeticallyIfNotAnnotated - whether properties of a type without JsonPropertyOrder should be sorted alphabeticallypublic int compare(MemberScope<?,?> first, MemberScope<?,?> second)
compare in interface Comparator<MemberScope<?,?>>protected int getPropertyIndex(MemberScope<?,?> property)
JsonPropertyOrder annotation. If no such annotation
is present, Integer.MAX_VALUE will be returned to append these at the end of the list of properties.property - field/method for which the respective index should be determinedInteger.MAX_VALUEprotected boolean shouldSortPropertiesAlphabetically(Class<?> declaringType)
JsonPropertyOrder annotation should be sorted
alphabetically, based on JsonPropertyOrder.alphabetic(). If no such annotation is present, the value given in the
JsonPropertySorter(boolean) constructor.declaringType - type for which the properties' default sorting should be determinedJsonPropertyOrder annotation should be sorted alphabeticallyCopyright © 2021 VicTools. All rights reserved.