Interface ISerializer<CLASS>
-
- 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 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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ISerializer<CLASS>applyConfiguration(IConfiguration<SerializationFeature<?>> other)ISerializer<CLASS>disableFeature(SerializationFeature<?> feature)ISerializer<CLASS>enableFeature(SerializationFeature<?> feature)default voidserialize(CLASS data, File file)Write data from a bound class instance to theFile.default voidserialize(CLASS data, OutputStream os)Write data from a bound class instance to theOutputStream.voidserialize(CLASS data, Writer writer)Write data from a bound class instance to theWriter.default voidserialize(CLASS data, Path path, OpenOption... openOptions)Write data from a bound class instance to theFile.ISerializer<CLASS>set(SerializationFeature<?> feature, Object value)-
Methods inherited from interface gov.nist.secauto.metaschema.core.configuration.IConfiguration
get, getFeatureValues, isFeatureEnabled
-
-
-
-
Method Detail
-
enableFeature
ISerializer<CLASS> enableFeature(SerializationFeature<?> feature)
- Specified by:
enableFeaturein interfaceIMutableConfiguration<CLASS>
-
disableFeature
ISerializer<CLASS> disableFeature(SerializationFeature<?> feature)
- Specified by:
disableFeaturein interfaceIMutableConfiguration<CLASS>
-
applyConfiguration
ISerializer<CLASS> applyConfiguration(IConfiguration<SerializationFeature<?>> other)
- Specified by:
applyConfigurationin interfaceIMutableConfiguration<CLASS>
-
set
ISerializer<CLASS> set(SerializationFeature<?> feature, Object value)
- Specified by:
setin interfaceIMutableConfiguration<CLASS>
-
serialize
default void serialize(@NonNull CLASS 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 CLASS 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 CLASS 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 CLASS 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
-
-