java.lang.Object
org.mule.runtime.extension.api.persistence.ExtensionModelJsonSerializer

public class ExtensionModelJsonSerializer extends Object
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 that ModelProperty.isPublic() returns true, will be serialized
  • Due to the nature of ModelProperty, that can be dynamically attached to any EnrichableModel, only the already know set of ModelProperty will be tagged with a friendly name, example: LayoutModel is going to be identified with the display name. Otherwise, the ModelProperty will 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 the ModelProperty object will be discarded
Since:
1.0
  • Constructor Details

    • ExtensionModelJsonSerializer

      public ExtensionModelJsonSerializer()
      Creates a new instance of the ExtensionModelJsonSerializer. This serializer is capable of serializing and deserializing ExtensionModel from JSON (deserialize(String) and to JSON ( serialize(ExtensionModel)
    • ExtensionModelJsonSerializer

      public ExtensionModelJsonSerializer(boolean prettyPrint)
      Creates a new instance of the ExtensionModelJsonSerializer.
      Parameters:
      prettyPrint - boolean indicating if the serialization of the ExtensionModel should be printed in a human readable or into compact and more performable format
  • Method Details

    • serialize

      public String serialize(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
      Serializes an ExtensionModel into JSON
      Parameters:
      extensionModel - ExtensionModel to be serialized
      Returns:
      String JSON representation of the ExtensionModel
    • serializeList

      public String serializeList(List<org.mule.runtime.api.meta.model.ExtensionModel> extensionModelList)
      Parameters:
      extensionModelList - List of ExtensionModel to be serialized
      Returns:
      String JSON representation of the List of ExtensionModel
    • deserialize

      public org.mule.runtime.api.meta.model.ExtensionModel deserialize(String extensionModel)
      Deserializes a JSON representation of an ExtensionModel, to an actual instance of it.
      Parameters:
      extensionModel - serialized ExtensionModel
      Returns:
      an instance of ExtensionModel based in the JSON
    • deserializeList

      public List<org.mule.runtime.api.meta.model.ExtensionModel> deserializeList(String extensionModelList)
      Deserializes a JSON representation of a List of ExtensionModel, to an actual instance of it.
      Parameters:
      extensionModelList - serialized List ExtensionModel
      Returns:
      an instance of ExtensionModel based in the JSON