Package org.mule.metadata.persistence
Class TypeAnnotationSerializer
- java.lang.Object
-
- org.mule.metadata.persistence.TypeAnnotationSerializer
-
public final class TypeAnnotationSerializer extends Object
Serializer forTypeAnnotation.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description TypeAnnotationSerializer(Map<String,Class<? extends TypeAnnotation>> stingClassMapping, Collection<Object> additionalFeatures, TypeAnnotationSerializerExtenderFallback typeAnnotationSerializerExtenderFallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends TypeAnnotation>
Optional<T>deserialize(String typeAnnotationName, String json)Deserializes aTypeAnnotationimplementation.Map<Class<? extends TypeAnnotation>,String>getClassNameMapping()Map<String,Class<? extends TypeAnnotation>>getNameClassMapping()<T extends TypeAnnotation>
voidserialize(com.google.gson.stream.JsonWriter jsonWriter, T typeAnnotation)Serializes aTypeAnnotationimplementation.
-
-
-
Constructor Detail
-
TypeAnnotationSerializer
public TypeAnnotationSerializer(Map<String,Class<? extends TypeAnnotation>> stingClassMapping, Collection<Object> additionalFeatures, TypeAnnotationSerializerExtenderFallback typeAnnotationSerializerExtenderFallback)
-
-
Method Detail
-
deserialize
public <T extends TypeAnnotation> Optional<T> deserialize(String typeAnnotationName, String json)
Deserializes aTypeAnnotationimplementation.- Parameters:
typeAnnotationName- name of theTypeAnnotationthat match withTypeAnnotation.getName()or their full qualifier class namejson-Stringrepresentation of the serializedTypeAnnotation- Returns:
- An
Optionalwith the deserializedTypeAnnotationin case that the deserialization could not be done,Optional.empty()will be returned
-
serialize
public <T extends TypeAnnotation> void serialize(com.google.gson.stream.JsonWriter jsonWriter, T typeAnnotation)
Serializes aTypeAnnotationimplementation.- Parameters:
jsonWriter-JsonWriterto write the serializedTypeAnnotationtypeAnnotation-TypeAnnotationimplementation to serialized
-
getNameClassMapping
public Map<String,Class<? extends TypeAnnotation>> getNameClassMapping()
- Returns:
- A
Mapthat links a friendly name with aTypeAnnotationclass. This is helpful when deserializing aTypeAnnotationto be able to create the correct instance type.
-
getClassNameMapping
public Map<Class<? extends TypeAnnotation>,String> getClassNameMapping()
- Returns:
- A
Mapthat links aTypeAnnotationclass with their friendly name. This is helpful when serializing aTypeAnnotationto be able to tag it with a more friendly name that the full qualifier name of the class.
-
-