Class JsonArtifactAstSerializer
java.lang.Object
org.mule.runtime.ast.internal.serialization.json.JsonArtifactAstSerializer
- All Implemented Interfaces:
ArtifactAstSerializer
This is an implementation of an
ArtifactAstSerializer that uses Gson to generate a Json String as the body of the
serialized representation-
Constructor Summary
ConstructorsConstructorDescriptionJsonArtifactAstSerializer(com.google.gson.Gson gson, Executor executor, String version) This constructor is for testing, and it allows overriding theGsoninstanceJsonArtifactAstSerializer(Executor executor, String version) Creates a serializer for the specified version. -
Method Summary
Modifier and TypeMethodDescriptionserialize(ArtifactAst artifactAst) Serializes anArtifactAstinto anInputStreamadding string metadata in the first line followed by the serialized content.
-
Constructor Details
-
JsonArtifactAstSerializer
Creates a serializer for the specified version.- Parameters:
executor- theExecutorto use for the serialization work.version- the version this serializer must adhere to.
-
JsonArtifactAstSerializer
This constructor is for testing, and it allows overriding theGsoninstance- Parameters:
gson- a pre-configuredGson, for testing purposes.executor- theExecutorto use for the serialization work.version- the version this serializer must adhere to.
-
-
Method Details
-
serialize
Description copied from interface:ArtifactAstSerializerSerializes anArtifactAstinto anInputStreamadding string metadata in the first line followed by the serialized content.- Specified by:
serializein interfaceArtifactAstSerializer- Parameters:
artifactAst- The AST of the artifact to be serialized- Returns:
- an
InputStreamcontaining a first line with metadata (a String with serializer id and version delimited by the character '#') followed by the serialized content.
-
getExecutor
-