Package org.mule.metadata.persistence
Class JsonMetadataTypeWriter
- java.lang.Object
-
- org.mule.metadata.persistence.AbstractJsonMetadataTypeWriter
-
- org.mule.metadata.persistence.JsonMetadataTypeWriter
-
- All Implemented Interfaces:
TypeWriter,MetadataTypeWriter
public class JsonMetadataTypeWriter extends AbstractJsonMetadataTypeWriter
MetadataTypeWriterimplementation that serialize a fullMetadataTypestructure to a matching JSON object.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from class org.mule.metadata.persistence.AbstractJsonMetadataTypeWriter
prettyPrint, typeStack, writer
-
-
Constructor Summary
Constructors Constructor Description JsonMetadataTypeWriter()Creates a new instance which serializes all types explicitly without handling referencesJsonMetadataTypeWriter(ObjectTypeReferenceHandler referenceHandler)Creates a new instance which handles type references through the givenreferenceHandlerJsonMetadataTypeWriter(ObjectTypeReferenceHandler referenceHandler, boolean allowNullInput)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonMetadataTypeWritersetPrettyPrint(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
-
-
-
-
Constructor Detail
-
JsonMetadataTypeWriter
public JsonMetadataTypeWriter()
Creates a new instance which serializes all types explicitly without handling references
-
JsonMetadataTypeWriter
public JsonMetadataTypeWriter(ObjectTypeReferenceHandler referenceHandler)
Creates a new instance which handles type references through the givenreferenceHandler- Parameters:
referenceHandler- anObjectTypeReferenceHandler
-
JsonMetadataTypeWriter
public JsonMetadataTypeWriter(ObjectTypeReferenceHandler referenceHandler, boolean allowNullInput)
-
-
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 JsonMetadataTypeWriter 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
-
-