Class ReducedJsonMetadataTypeWriter
- java.lang.Object
-
- org.mule.metadata.persistence.AbstractJsonMetadataTypeWriter
-
- org.mule.metadata.persistence.reduced.ReducedJsonMetadataTypeWriter
-
- All Implemented Interfaces:
TypeWriter,MetadataTypeWriter
public class ReducedJsonMetadataTypeWriter extends AbstractJsonMetadataTypeWriter
MetadataTypeWriterimplementation that serializes aMetadataTypeobject into a JSON object with a reduced structure by creating a type catalog for allObjectTypes 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
MetadataTypestructure 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.- Since:
- 1.2.0, 1.1.7
-
-
Field Summary
-
Fields inherited from class org.mule.metadata.persistence.AbstractJsonMetadataTypeWriter
prettyPrint, typeStack, writer
-
-
Constructor Summary
Constructors Constructor Description ReducedJsonMetadataTypeWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReducedJsonMetadataTypeWritersetPrettyPrint(boolean prettyPrint)Changes the value of PrettyPrint property of theReducedJsonMetadataTypeWriter.protected voidwrite(MetadataType type)Given aMetadataType, serializes it into a JSON format.-
Methods inherited from class org.mule.metadata.persistence.AbstractJsonMetadataTypeWriter
toString, write
-
-
-
-
Method Detail
-
write
protected void write(MetadataType type) throws IOException
Given aMetadataType, serializes it into a JSON format.It is expected that a proper writer is already set to this object.
- Specified by:
writein classAbstractJsonMetadataTypeWriter- Parameters:
type-MetadataTypeto doSerialize.- Throws:
IOException- if any error occurred when writing the JSON file.
-
setPrettyPrint
public ReducedJsonMetadataTypeWriter setPrettyPrint(boolean prettyPrint)
Description copied from class:AbstractJsonMetadataTypeWriterChanges the value of PrettyPrint property of theReducedJsonMetadataTypeWriter. If it is enabled, whenAbstractJsonMetadataTypeWriter.toString(MetadataType)is executed the outputStringwill be printed in a human readable format, otherwise, by default, the JSON will be printed in a compact and more performable format.- Overrides:
setPrettyPrintin classAbstractJsonMetadataTypeWriter- Parameters:
prettyPrint- boolean value indicating if the writer should pretty print the JSON- Returns:
- the configured
TypeWriterinstance
-
-