public class ReducedJsonMetadataTypeWriter extends AbstractJsonMetadataTypeWriter
MetadataTypeWriter implementation that serializes a MetadataType object into a JSON object with a reduced
structure by creating a type catalog for all ObjectTypes found.
The end serialization ends up with an structure like the one described in the following snippet.
/**
{
"value": {...}
"catalog": {...}
}
The value element contains the serializing MetadataType structure with references to the catalog. NOTE that if the
serializing object is an object type, then a simple reference to the catalog will be described in the value field. e.g.: @{code
... "value"{ type: "@ref:myObjectTypeId" } ...}
The catalog contains all the described object types in the root MetadataType, also, ObjectTypes described in
the catalog can also contain references to other types declared in that catalog.
prettyPrint, typeStack, writer| Constructor and Description |
|---|
ReducedJsonMetadataTypeWriter() |
| Modifier and Type | Method and Description |
|---|---|
ReducedJsonMetadataTypeWriter |
setPrettyPrint(boolean prettyPrint)
Changes the value of PrettyPrint property of the
ReducedJsonMetadataTypeWriter. |
protected void |
write(MetadataType type)
Given a
MetadataType, serializes it into a JSON format. |
toString, writeprotected 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.
write in class AbstractJsonMetadataTypeWritertype - MetadataType to doSerialize.IOException - if any error occurred when writing the JSON file.public ReducedJsonMetadataTypeWriter setPrettyPrint(boolean prettyPrint)
AbstractJsonMetadataTypeWriterReducedJsonMetadataTypeWriter. If it is enabled, when
AbstractJsonMetadataTypeWriter.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.setPrettyPrint in class AbstractJsonMetadataTypeWriterprettyPrint - boolean value indicating if the writer should pretty print the JSONTypeWriter instanceCopyright © 2022 MuleSoft, Inc.. All rights reserved.