java.lang.Object
org.mule.runtime.ast.internal.serialization.json.JsonArtifactAstSerializer
All Implemented Interfaces:
ArtifactAstSerializer

public class JsonArtifactAstSerializer extends Object implements ArtifactAstSerializer
This is an implementation of an ArtifactAstSerializer that uses Gson to generate a Json String as the body of the serialized representation
  • Constructor Details

    • JsonArtifactAstSerializer

      public JsonArtifactAstSerializer(Executor executor, String version)
      Creates a serializer for the specified version.
      Parameters:
      executor - the Executor to use for the serialization work.
      version - the version this serializer must adhere to.
    • JsonArtifactAstSerializer

      public JsonArtifactAstSerializer(com.google.gson.Gson gson, Executor executor, String version)
      This constructor is for testing, and it allows overriding the Gson instance
      Parameters:
      gson - a pre-configured Gson, for testing purposes.
      executor - the Executor to use for the serialization work.
      version - the version this serializer must adhere to.
  • Method Details

    • serialize

      public InputStream serialize(ArtifactAst artifactAst)
      Description copied from interface: ArtifactAstSerializer
      Serializes an ArtifactAst into an InputStream adding string metadata in the first line followed by the serialized content.
      Specified by:
      serialize in interface ArtifactAstSerializer
      Parameters:
      artifactAst - The AST of the artifact to be serialized
      Returns:
      an InputStream containing a first line with metadata (a String with serializer id and version delimited by the character '#') followed by the serialized content.
    • getExecutor

      public Executor getExecutor()