Interface IDeserializer<CLASS extends IBoundObject>

Type Parameters:
CLASS - the Java type into which data can be read
All Superinterfaces:
IConfiguration<DeserializationFeature<?>>, IMutableConfiguration<DeserializationFeature<?>>
All Known Implementing Classes:
AbstractDeserializer, DefaultJsonDeserializer, DefaultXmlDeserializer, DefaultYamlDeserializer

public interface IDeserializer<CLASS extends IBoundObject> extends IMutableConfiguration<DeserializationFeature<?>>
Implementations of this interface are able to read structured data into a bound object instance of the parameterized type.
  • Method Details

    • enableFeature

      IDeserializer<CLASS> enableFeature(DeserializationFeature<?> feature)
      Description copied from interface: IMutableConfiguration
      Turn on the provided feature.
      Specified by:
      enableFeature in interface IMutableConfiguration<CLASS extends IBoundObject>
      Parameters:
      feature - the feature to turn on
      Returns:
      the updated configuration
      See Also:
    • disableFeature

      IDeserializer<CLASS> disableFeature(DeserializationFeature<?> feature)
      Description copied from interface: IMutableConfiguration
      Turn off the provided feature.
      Specified by:
      disableFeature in interface IMutableConfiguration<CLASS extends IBoundObject>
      Parameters:
      feature - the feature to turn off
      Returns:
      the updated configuration
      See Also:
    • applyConfiguration

      IDeserializer<CLASS> applyConfiguration(IConfiguration<DeserializationFeature<?>> other)
      Description copied from interface: IMutableConfiguration
      Replace this configuration with the other configuration.
      Specified by:
      applyConfiguration in interface IMutableConfiguration<CLASS extends IBoundObject>
      Parameters:
      other - the new configuration
      Returns:
      the updated configuration
    • set

      Description copied from interface: IMutableConfiguration
      Set the value of the provided feature to the provided value.
      Specified by:
      set in interface IMutableConfiguration<CLASS extends IBoundObject>
      Parameters:
      feature - the feature to set
      value - the value to set
      Returns:
      the updated configuration
      See Also:
    • isValidating

      default boolean isValidating()
      Determine if the serializer is performing validation.
      Returns:
      true if the serializer is performing content validation, or false otherwise
    • getConstraintValidationHandler

      @NonNull IConstraintValidationHandler getConstraintValidationHandler()
      Get the constraint validation handler configured for this deserializer, which will be used to validate loaded data.
      Returns:
      the validation handler
    • setConstraintValidationHandler

      void setConstraintValidationHandler(@NonNull IConstraintValidationHandler handler)
      Set the constraint violation handler for constraint validation.
      Parameters:
      handler - the handler to use
    • deserialize

      @NonNull default CLASS deserialize(@NonNull InputStream is, @NonNull URI documentUri) throws IOException
      Read data from the InputStream into a bound class instance.
      Parameters:
      is - the input stream to read from
      documentUri - the URI of the document to read from
      Returns:
      the instance data
      Throws:
      IOException - if an error occurred while reading data from the stream
    • deserialize

      @NonNull default CLASS deserialize(@NonNull Path path) throws IOException
      Read data from the Path into a bound class instance.
      Parameters:
      path - the file to read from
      Returns:
      the instance data
      Throws:
      IOException - if an error occurred while writing data to the file indicated by the path parameter
    • deserialize

      @NonNull default CLASS deserialize(@NonNull File file) throws IOException
      Read data from the File into a bound class instance.
      Parameters:
      file - the file to read from
      Returns:
      the instance data
      Throws:
      IOException - if an error occurred while reading data from the stream
    • deserialize

      @NonNull default CLASS deserialize(@NonNull URL url) throws IOException, URISyntaxException
      Read data from the remote resource into a bound class instance.
      Parameters:
      url - the remote resource to read from
      Returns:
      the instance data
      Throws:
      IOException - if an error occurred while reading data from the stream
      URISyntaxException - if the provided URL is not formatted strictly according to to RFC2396 and cannot be converted to a URI.
    • deserialize

      @NonNull default CLASS deserialize(@NonNull Reader reader, @NonNull URI documentUri) throws IOException
      Read data from the Reader into a bound class instance.
      Parameters:
      reader - the reader to read from
      documentUri - the URI of the document to read from
      Returns:
      the instance data
      Throws:
      IOException - if an error occurred while reading data from the stream
    • deserializeToNodeItem

      @NonNull default INodeItem deserializeToNodeItem(@NonNull InputStream is, @NonNull URI documentUri) throws IOException
      Read data from the Reader into a node item instance.
      Parameters:
      is - the input stream to read from
      documentUri - the URI of the document to read from
      Returns:
      a new node item
      Throws:
      IOException - if an error occurred while reading data from the stream
    • deserializeToNodeItem

      @NonNull INodeItem deserializeToNodeItem(@NonNull Reader reader, @NonNull URI documentUri) throws IOException
      Read data from the Reader into a node item instance.
      Parameters:
      reader - the reader to read from
      documentUri - the URI of the document to read from
      Returns:
      a new node item
      Throws:
      IOException - if an error occurred while reading data from the stream
    • deserializeToValue

      @NonNull CLASS deserializeToValue(@NonNull Reader reader, @NonNull URI documentUri) throws IOException
      Read data from the Reader into a node item instance.
      Parameters:
      reader - the reader to read from
      documentUri - the URI of the document to read from
      Returns:
      a new node item
      Throws:
      IOException - if an error occurred while reading data from the stream