Module dev.metaschema.databind
Class AbstractModelInstanceWriteHandler<ITEM>
java.lang.Object
dev.metaschema.databind.model.info.AbstractModelInstanceWriteHandler<ITEM>
- Type Parameters:
ITEM- the Java type of items being written
- All Implemented Interfaces:
IModelInstanceWriteHandler<ITEM>
public abstract class AbstractModelInstanceWriteHandler<ITEM>
extends Object
implements IModelInstanceWriteHandler<ITEM>
An abstract base class for writing model instance collections.
This class provides the framework for writing collections of items during serialization, with support for different collection types.
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new write handler for the provided model instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the collection information.Get the associated instance.voidWrite items from a list collection.voidWrite items from a map collection.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.metaschema.databind.model.info.IModelInstanceWriteHandler
writeItem, writeSingleton
-
Constructor Details
-
AbstractModelInstanceWriteHandler
Construct a new write handler for the provided model instance.- Parameters:
instance- the model instance to write
-
-
Method Details
-
getInstance
Get the associated instance.- Returns:
- the instance
-
getCollectionInfo
Get the collection information.- Returns:
- the info
-
writeList
Description copied from interface:IModelInstanceWriteHandlerWrite items from a list collection.- Specified by:
writeListin interfaceIModelInstanceWriteHandler<ITEM>- Parameters:
items- the list of items to write- Throws:
IOException- if an error occurred while writing the output
-
writeMap
Description copied from interface:IModelInstanceWriteHandlerWrite items from a map collection.- Specified by:
writeMapin interfaceIModelInstanceWriteHandler<ITEM>- Parameters:
items- the map of items to write, keyed by JSON key flag value- Throws:
IOException- if an error occurred while writing the output
-