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 Details

    • enableFeature

      Specified by:
      enableFeature in interface dev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
    • disableFeature

      Specified by:
      disableFeature in interface dev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
    • applyConfiguration

      ISerializer<CLASS> applyConfiguration(dev.metaschema.core.configuration.IConfiguration<SerializationFeature<?>> other)
      Specified by:
      applyConfiguration in interface dev.metaschema.core.configuration.IMutableConfiguration<CLASS extends dev.metaschema.core.model.IBoundObject>
    • set

      Specified by:
      set in interface dev.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 the OutputStream.

      This method does not have ownership of the the provided output stream and will not close it.

      Parameters:
      data - the instance data
      os - 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 the File.
      Parameters:
      data - the instance data
      path - the file to write to
      openOptions - options specifying how the file is opened
      Throws:
      IOException - if an error occurred while writing data to the file indicated by the path parameter
    • serialize

      default void serialize(@NonNull dev.metaschema.core.model.IBoundObject data, @NonNull File file) throws IOException
      Write data from a bound class instance to the File.
      Parameters:
      data - the instance data
      file - 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 the Writer.
      Parameters:
      data - the instance data
      writer - the writer to write to
      Throws:
      IOException - if an error occurred while writing data to the stream