Class ExtensionModelJsonSerializer
java.lang.Object
org.mule.runtime.extension.api.persistence.ExtensionModelJsonSerializer
Serializer that can convert a
ExtensionModel into a readable and processable JSON representation and from a JSON
String to an ExtensionModel instance
Considerations:
- Only
ModelPropertys that are considered as externalizable, the ones thatModelProperty.isPublic()returnstrue, will be serialized - Due to the nature of
ModelProperty, that can be dynamically attached to anyEnrichableModel, only the already know set ofModelPropertywill be tagged with a friendly name, example:LayoutModelis going to be identified with thedisplayname. Otherwise, theModelPropertywill be serialized tagging it with the full qualifier name of the class. - When deserializing
ModelPropertys, their full qualified name will be used, if the class is not found in the ClassLoader theModelPropertyobject will be discarded
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of theExtensionModelJsonSerializer.ExtensionModelJsonSerializer(boolean prettyPrint) Creates a new instance of theExtensionModelJsonSerializer. -
Method Summary
Modifier and TypeMethodDescriptionorg.mule.runtime.api.meta.model.ExtensionModeldeserialize(String extensionModel) Deserializes a JSON representation of anExtensionModel, to an actual instance of it.List<org.mule.runtime.api.meta.model.ExtensionModel>deserializeList(String extensionModelList) Deserializes a JSON representation of aListofExtensionModel, to an actual instance of it.serialize(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Serializes anExtensionModelinto JSONserializeList(List<org.mule.runtime.api.meta.model.ExtensionModel> extensionModelList)
-
Constructor Details
-
ExtensionModelJsonSerializer
public ExtensionModelJsonSerializer()Creates a new instance of theExtensionModelJsonSerializer. This serializer is capable of serializing and deserializingExtensionModelfrom JSON (deserialize(String)and to JSON (serialize(ExtensionModel) -
ExtensionModelJsonSerializer
public ExtensionModelJsonSerializer(boolean prettyPrint) Creates a new instance of theExtensionModelJsonSerializer.- Parameters:
prettyPrint- boolean indicating if the serialization of theExtensionModelshould be printed in a human readable or into compact and more performable format
-
-
Method Details
-
serialize
Serializes anExtensionModelinto JSON- Parameters:
extensionModel-ExtensionModelto be serialized- Returns:
StringJSON representation of theExtensionModel
-
serializeList
-
deserialize
Deserializes a JSON representation of anExtensionModel, to an actual instance of it.- Parameters:
extensionModel- serializedExtensionModel- Returns:
- an instance of
ExtensionModelbased in the JSON
-
deserializeList
public List<org.mule.runtime.api.meta.model.ExtensionModel> deserializeList(String extensionModelList) Deserializes a JSON representation of aListofExtensionModel, to an actual instance of it.- Parameters:
extensionModelList- serializedListExtensionModel- Returns:
- an instance of
ExtensionModelbased in the JSON
-