Module dev.metaschema.databind
Package dev.metaschema.databind.io
Interface ISerializer<CLASS extends dev.metaschema.core.model.IBoundObject>
- Type Parameters:
CLASS- the Java type from which data can be written
- All Superinterfaces:
dev.metaschema.core.configuration.IConfiguration<SerializationFeature<?>>,dev.metaschema.core.configuration.IMutableConfiguration<SerializationFeature<?>>
- All Known Implementing Classes:
AbstractSerializer,DefaultJsonSerializer,DefaultXmlSerializer,DefaultYamlSerializer
public interface ISerializer<CLASS extends dev.metaschema.core.model.IBoundObject>
extends dev.metaschema.core.configuration.IMutableConfiguration<SerializationFeature<?>>
Implementations of this interface are able to write data in a bound object
instance of the parameterized type to a structured data format.
-
Method Summary
Modifier and TypeMethodDescriptionapplyConfiguration(dev.metaschema.core.configuration.IConfiguration<SerializationFeature<?>> other) disableFeature(SerializationFeature<?> feature) enableFeature(SerializationFeature<?> feature) default voidWrite data from a bound class instance to theFile.default voidserialize(dev.metaschema.core.model.IBoundObject data, OutputStream os) Write data from a bound class instance to theOutputStream.voidWrite data from a bound class instance to theWriter.default voidserialize(dev.metaschema.core.model.IBoundObject data, Path path, OpenOption... openOptions) Write data from a bound class instance to theFile.set(SerializationFeature<?> feature, Object value) Methods inherited from interface dev.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabled
-
Method Details
-
enableFeature
- Specified by:
enableFeaturein interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
disableFeature
- Specified by:
disableFeaturein interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
applyConfiguration
ISerializer<CLASS> applyConfiguration(dev.metaschema.core.configuration.IConfiguration<SerializationFeature<?>> other) - Specified by:
applyConfigurationin interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
set
- Specified by:
setin interfacedev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
-
serialize
default void serialize(@NonNull dev.metaschema.core.model.IBoundObject data, @NonNull OutputStream os) throws IOException Write data from a bound class instance to theOutputStream.This method does not have ownership of the the provided output stream and will not close it.
- Parameters:
data- the instance dataos- the output stream to write to- Throws:
IOException- if an error occurred while writing data to the stream
-
serialize
default void serialize(@NonNull dev.metaschema.core.model.IBoundObject data, @NonNull Path path, OpenOption... openOptions) throws IOException Write data from a bound class instance to theFile.- Parameters:
data- the instance datapath- the file to write toopenOptions- options specifying how the file is opened- Throws:
IOException- if an error occurred while writing data to the file indicated by thepathparameter
-
serialize
default void serialize(@NonNull dev.metaschema.core.model.IBoundObject data, @NonNull File file) throws IOException Write data from a bound class instance to theFile.- Parameters:
data- the instance datafile- the file to write to- Throws:
IOException- if an error occurred while writing data to the stream
-
serialize
void serialize(@NonNull dev.metaschema.core.model.IBoundObject data, @NonNull Writer writer) throws IOException Write data from a bound class instance to theWriter.- Parameters:
data- the instance datawriter- the writer to write to- Throws:
IOException- if an error occurred while writing data to the stream
-