Interface SmithyIdlSerializationOrder
- All Known Implementing Classes:
SmithyIdlComponentOrder
public interface SmithyIdlSerializationOrder
Configures how shapes, traits, and metadata are ordered when serializing a model
with
SmithyIdlModelSerializer.
The built-in orderings are available as constants on SmithyIdlComponentOrder.
Implement this interface directly to provide custom ordering logic.
Only shapeComparator() is required. The default implementations of
traitComparator() and metadataComparator() sort alphabetically,
which is suitable for most use cases.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<Shape>A shape comparator that sorts alphabetically by shape ID. -
Method Summary
Modifier and TypeMethodDescriptiondefault Comparator<Map.Entry<String,Node>> Returns a comparator used to sort metadata entries.Returns a comparator used to sort shapes within a namespace file.default Comparator<Trait>Returns a comparator used to sort traits applied to a shape.
-
Field Details
-
ALPHABETICAL
A shape comparator that sorts alphabetically by shape ID.
-
-
Method Details
-
shapeComparator
Comparator<Shape> shapeComparator()Returns a comparator used to sort shapes within a namespace file.- Returns:
- Comparator for ordering shapes.
-
traitComparator
Returns a comparator used to sort traits applied to a shape.The default implementation sorts traits alphabetically by their shape ID. Custom implementations that use source-location-based ordering should consider overriding this method to also sort traits by source location for consistency.
- Returns:
- Comparator for ordering traits.
-
metadataComparator
Returns a comparator used to sort metadata entries.The default implementation sorts metadata alphabetically by key.
- Returns:
- Comparator for ordering metadata entries.
-