Package org.approvej.print
Class PropertyOrdering
java.lang.Object
org.approvej.print.PropertyOrdering
Utility for deterministic property ordering during serialization.
Field-backed properties are ordered first in their declaration order, followed by any additional properties (e.g. from getters) in alphabetical order.
-
Method Summary
-
Method Details
-
reorder
public static <T> List<T> reorder(Class<?> type, List<T> properties, Function<T, String> nameExtractor) Reorders a list of named properties so that field-backed properties appear first in their declaration order, followed by remaining properties sorted alphabetically.- Type Parameters:
T- the type of property elements- Parameters:
type- the class whose field declaration order determines property orderingproperties- the properties to reordernameExtractor- a function to extract the property name from each element- Returns:
- a new list with properties in deterministic order
-