Class SerdeSourceGenPropertyOrder
java.lang.Object
io.micronaut.serde.processor.sourcegen.SerdeSourceGenPropertyOrder
Orders the properties a generated serializer writes the way the runtime object serializer orders them.
The runtime serializer writes the properties named by a type-level property order first, in that order, followed by the remaining properties in declaration order, and moves XML attribute properties in front of the element properties without changing their relative order. An alphabetic property order sorts every property by its serialized name.
- Since:
- 3.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasExplicitOrder(io.micronaut.inject.ast.ClassElement element) Whether the type declares a property order the generated serializer applies.static <T> List<T> order(io.micronaut.inject.ast.ClassElement element, List<T> properties, Function<T, String> serializedName, Function<T, String> originalName, Predicate<T> xmlAttribute) Orders the properties for serialization.
-
Method Details
-
order
public static <T> List<T> order(io.micronaut.inject.ast.ClassElement element, List<T> properties, Function<T, String> serializedName, Function<T, String> originalName, Predicate<T> xmlAttribute) Orders the properties for serialization.- Type Parameters:
T- The property type- Parameters:
element- The serialized typeproperties- The properties in declaration orderserializedName- The serialized name of a propertyoriginalName- The declared name of a propertyxmlAttribute- Whether a property is written as an XML attribute- Returns:
- The properties in write order
-
hasExplicitOrder
public static boolean hasExplicitOrder(io.micronaut.inject.ast.ClassElement element) Whether the type declares a property order the generated serializer applies.- Parameters:
element- The serialized type- Returns:
trueif a property order is declared on the type
-