Interface TypeAnnotationSerializerExtender
-
public interface TypeAnnotationSerializerExtenderInterface to be implemented to extend the functionality ofMetadataTypeserialization. The implementation of this class is highly recommended when using customTypeAnnotations in aMetadataTypedescription to be able to create more human readable serialization output. This implementations will be located using SPI.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Collection<Object>getAdditionalFeatures()Provides an unspecific list of additional serialization features.default Map<String,Class<? extends TypeAnnotation>>getNameClassMapping()The purpose of this registry is to provide a mapping between a "friendly name" (TypeAnnotation.getName()) and the correspondent concrete class (TypeAnnotation#getClass()), this allows to the serialization to write a more compact and easy to read name, instead of using the full qualifier name of the concrete class.
-
-
-
Method Detail
-
getNameClassMapping
default Map<String,Class<? extends TypeAnnotation>> getNameClassMapping()
The purpose of this registry is to provide a mapping between a "friendly name" (TypeAnnotation.getName()) and the correspondent concrete class (TypeAnnotation#getClass()), this allows to the serialization to write a more compact and easy to read name, instead of using the full qualifier name of the concrete class. Using this mapping the serialization goes from:{"org.mule.metadata.api.annotation.TypeIdAnnotation":"java.lang.String"}To:{"typeId":"java.lang.String"}By default theMetadataTypeserialization will provide mappings for out of the boxTypeAnnotationimplementations asTypeIdAnnotation,LabelAnnotation, etc. Considerations:- The name used as Key of the map for a class, should be the same in
TypeAnnotation.getName() - If a mapping is not found for a given
TypeAnnotationthe full qualifier name will be used - If a mapping tries to use a taken name from an already provided
TypeAnnotationimplementation, the serialization will fail - If the class defined for a
TypeAnnotationimplementation is not found in the in the ClassLoader, the deserialization of this object will be ignored.
- Returns:
- a map with the mapping classes by type annotation name.
- The name used as Key of the map for a class, should be the same in
-
getAdditionalFeatures
default Collection<Object> getAdditionalFeatures()
Provides an unspecific list of additional serialization features. Because this interface is meant to remain agnostic of the actual serialization implementation, these features are represented as simply objects in order to avoid exposing internal classes. Also, because these features might be implementation specific, the consumer of this class is free to skip the features it cannot handle. Thus, the features returned here are to be considered more like a suggestion to the serializer than an actual directive.- Returns:
- a list with additional serialization features
-
-