Interface ISerializer<CLASS extends IBoundObject>
- Type Parameters:
CLASS- the Java type from which data can be written
- All Superinterfaces:
IConfiguration<SerializationFeature<?>>,IMutableConfiguration<SerializationFeature<?>>
- All Known Implementing Classes:
AbstractSerializer,DefaultJsonSerializer,DefaultXmlSerializer,DefaultYamlSerializer
public interface ISerializer<CLASS extends IBoundObject>
extends 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(IConfiguration<SerializationFeature<?>> other) disableFeature(SerializationFeature<?> feature) enableFeature(SerializationFeature<?> feature) default voidserialize(IBoundObject data, File file) Write data from a bound class instance to theFile.default voidserialize(IBoundObject data, OutputStream os) Write data from a bound class instance to theOutputStream.voidserialize(IBoundObject data, Writer writer) Write data from a bound class instance to theWriter.default voidserialize(IBoundObject data, Path path, OpenOption... openOptions) Write data from a bound class instance to theFile.set(SerializationFeature<?> feature, Object value) Methods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabled
-
Method Details
-
enableFeature
- Specified by:
enableFeaturein interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
disableFeature
- Specified by:
disableFeaturein interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
applyConfiguration
- Specified by:
applyConfigurationin interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
set
- Specified by:
setin interfaceIMutableConfiguration<CLASS extends IBoundObject>
-
serialize
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 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
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
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
-