public abstract class AbstractJsonMetadataTypeWriter extends Object implements TypeWriter, MetadataTypeWriter
MetadataTypeWriters implementations that serialize MetadataType objects into a readable and
processable JSON file, that can be deserialize again into a MetadataType using a SerializedMetadataTypeLoader.
This class is not Thread-safe.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
prettyPrint |
protected Stack<MetadataType> |
typeStack |
protected com.google.gson.stream.JsonWriter |
writer |
| Constructor and Description |
|---|
AbstractJsonMetadataTypeWriter() |
| Modifier and Type | Method and Description |
|---|---|
AbstractJsonMetadataTypeWriter |
setPrettyPrint(boolean prettyPrint)
Changes the value of PrettyPrint property of the
ReducedJsonMetadataTypeWriter. |
String |
toString(MetadataType structure)
Given a
MetadataType, serializes it into JSON format, the result of the serialization will be the output of the
operation as a String |
protected abstract void |
write(MetadataType type)
Given a
MetadataType, serializes it into a JSON format. |
void |
write(MetadataType metadataType,
com.google.gson.stream.JsonWriter writer)
Given a
MetadataType, serializes it into a JSON format, the result of the serialization will be written by the
. |
protected com.google.gson.stream.JsonWriter writer
protected Stack<MetadataType> typeStack
protected boolean prettyPrint
public String toString(MetadataType structure)
MetadataType, serializes it into JSON format, the result of the serialization will be the output of the
operation as a StringtoString in interface TypeWriterstructure - MetadataType to doSerialize.MetadataSerializingException - in any error casepublic void write(MetadataType metadataType, com.google.gson.stream.JsonWriter writer) throws IOException
MetadataType, serializes it into a JSON format, the result of the serialization will be written by the
.write in interface MetadataTypeWritermetadataType - MetadataType to doSerialize.writer - JsonWriter which will be used to write the serialized MetadataTypeIOException - if any error occurred when writing the JSON file.protected abstract void write(MetadataType type) throws IOException
MetadataType, serializes it into a JSON format.
It is expected that a proper writer is already set to this object.
type - MetadataType to doSerialize.IOException - if any error occurred when writing the JSON file.public AbstractJsonMetadataTypeWriter setPrettyPrint(boolean prettyPrint)
ReducedJsonMetadataTypeWriter. If it is enabled, when
toString(MetadataType) is executed the output String will be printed in a human readable format, otherwise,
by default, the JSON will be printed in a compact and more performable format.prettyPrint - boolean value indicating if the writer should pretty print the JSONTypeWriter instanceCopyright © 2025 MuleSoft, Inc.. All rights reserved.