All Superinterfaces:
IConfiguration<DeserializationFeature<?>>, IDocumentLoader, IMutableConfiguration<DeserializationFeature<?>>, IResourceResolver
All Known Implementing Classes:
DefaultBoundLoader

A common interface for loading Module based instance resources.
  • Method Details

    • enableFeature

      Specified by:
      enableFeature in interface IMutableConfiguration<DeserializationFeature<?>>
    • disableFeature

      Specified by:
      disableFeature in interface IMutableConfiguration<DeserializationFeature<?>>
    • applyConfiguration

      Specified by:
      applyConfiguration in interface IMutableConfiguration<DeserializationFeature<?>>
    • set

      Specified by:
      set in interface IMutableConfiguration<DeserializationFeature<?>>
    • detectFormat

      @NonNull default Format detectFormat(@NonNull File file) throws IOException
      Determine the format of the provided resource.
      Parameters:
      file - the resource
      Returns:
      the format information for the provided resource
      Throws:
      IOException - if an error occurred while reading the resource
    • detectFormat

      @NonNull default Format detectFormat(@NonNull Path path) throws IOException
      Determine the format of the provided resource.
      Parameters:
      path - the resource
      Returns:
      the format information for the provided resource
      Throws:
      IOException - if an error occurred while reading the resource
    • detectFormat

      @NonNull default Format detectFormat(@NonNull URL url) throws IOException
      Determine the format of the provided resource.
      Parameters:
      url - the resource
      Returns:
      the format information for the provided resource
      Throws:
      IOException - if an error occurred while reading the resource
    • detectFormat

      @NonNull Format detectFormat(@NonNull URI uri) throws IOException
      Determine the format of the resource identified by the provided uri.
      Parameters:
      uri - the resource
      Returns:
      the format information for the provided resource
      Throws:
      IOException - if an error occurred while reading the resource
    • detectFormat

      Determine the format of the provided resource.

      This method will consume data from the provided InputStream. If the caller of this method intends to read data from the stream after determining the format, the caller should pass in a stream that can be reset.

      This method will not close the provided InputStream, since it does not own the stream.

      Parameters:
      is - an input stream for the resource
      Returns:
      the format information for the provided resource
      Throws:
      IOException - if an error occurred while reading the resource
    • detectModel

      @NonNull @Owning ModelDetector.Result detectModel(@NonNull InputStream is, @NonNull Format format) throws IOException
      Determine the model of the provided resource.

      This method will consume data from any InputStream provided by the InputSource. If the caller of this method intends to read data from the stream after determining the format, the caller should pass in a stream that can be reset.

      This method will not close any InputStream provided by the InputSource, since it does not own the stream.

      Parameters:
      is - an input stream for the resource
      format - the format of the provided resource
      Returns:
      the model of the provided resource
      Throws:
      IOException - if an error occurred while reading the resource
    • load

      @NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull File file) throws IOException
      Load data from the provided resource into a bound object.

      This method will auto-detect the format of the provided resource.

      Type Parameters:
      CLASS - the type of the bound object to return
      Parameters:
      file - the resource
      Returns:
      a bound object containing the loaded data
      Throws:
      IOException - if an error occurred while reading the resource
      See Also:
    • load

      @NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Path path) throws IOException
      Load data from the provided resource into a bound object.

      This method will auto-detect the format of the provided resource.

      Type Parameters:
      CLASS - the type of the bound object to return
      Parameters:
      path - the resource
      Returns:
      a bound object containing the loaded data
      Throws:
      IOException - if an error occurred while reading the resource
      See Also:
    • load

      @NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull URL url) throws IOException, URISyntaxException
      Load data from the provided resource into a bound object.

      This method will auto-detect the format of the provided resource.

      Type Parameters:
      CLASS - the type of the bound object to return
      Parameters:
      url - the resource
      Returns:
      a bound object containing the loaded data
      Throws:
      IOException - if an error occurred while reading the resource
      URISyntaxException - if the provided url is malformed
      See Also:
    • load

      @NonNull <CLASS extends IBoundObject> CLASS load(@NonNull URI uri) throws IOException
      Load data from the resource identified by the provided uri into a bound object.

      This method will auto-detect the format of the provided resource.

      Type Parameters:
      CLASS - the type of the bound object to return
      Parameters:
      uri - the resource
      Returns:
      a bound object containing the loaded data
      Throws:
      IOException - if an error occurred while reading the resource
      See Also:
    • load

      @NonNull <CLASS extends IBoundObject> CLASS load(@NonNull InputStream is, @NonNull URI documentUri) throws IOException
      Load data from the provided resource into a bound object.

      This method should auto-detect the format of the provided resource.

      This method will not close the provided InputStream, since it does not own the stream.

      Type Parameters:
      CLASS - the type of the bound object to return
      Parameters:
      is - the resource stream
      documentUri - the URI of the resource
      Returns:
      a bound object containing the loaded data
      Throws:
      IOException - if an error occurred while reading the resource
      See Also:
    • load

      @NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull File file) throws IOException
      Load data from the specified resource into a bound object with the type of the specified Java class.
      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      clazz - the class for the java type
      file - the resource to load
      Returns:
      the loaded instance data
      Throws:
      IOException - if an error occurred while loading the data in the specified file
    • load

      @NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull Path path) throws IOException
      Load data from the specified resource into a bound object with the type of the specified Java class.
      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      clazz - the class for the java type
      path - the resource to load
      Returns:
      the loaded instance data
      Throws:
      IOException - if an error occurred while loading the data in the specified file
    • load

      @NonNull default <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull URL url) throws IOException, URISyntaxException
      Load data from the specified resource into a bound object with the type of the specified Java class.
      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      clazz - the class for the java type
      url - the resource to load
      Returns:
      the loaded instance data
      Throws:
      IOException - if an error occurred while loading the data in the specified file
      URISyntaxException - if the provided url is malformed
    • load

      @NonNull <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull URI uri) throws IOException
      Load data from the specified resource into a bound object with the type of the specified Java class.
      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      clazz - the class for the java type
      uri - the resource to load
      Returns:
      the loaded instance data
      Throws:
      IOException - if an error occurred while loading the data in the specified file
    • load

      @NonNull <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull InputStream is, @NonNull URI documentUri) throws IOException
      Load data from the specified resource into a bound object with the type of the specified Java class.

      This method will not close the provided InputStream, since it does not own the stream.

      Implementations of this method will do format detection. This process might leave the provided InputStream at a position beyond the last parsed location. If you want to avoid this possibility, use and implementation of IDeserializer.deserialize(InputStream, URI) instead, such as what is provided by DefaultBindingContext.newDeserializer(Format, Class).

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      clazz - the class for the java type
      is - the resource stream
      documentUri - the URI of the resource
      Returns:
      the loaded data
      Throws:
      IOException - if an error occurred while loading the data from the specified resource
    • load

      @NonNull <CLASS extends IBoundObject> CLASS load(@NonNull Class<CLASS> clazz, @NonNull Format format, @NonNull InputStream is, @NonNull URI documentUri) throws IOException
      Load data from the specified resource into a bound object with the type of the specified Java class.

      This method will not close the provided InputStream, since it does not own the stream.

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      format - the format to parse
      clazz - the class for the java type
      is - the resource stream
      documentUri - the URI of the resource
      Returns:
      the loaded data
      Throws:
      IOException - if an error occurred while loading the data from the specified resource
    • loadAsNodeItem

      @NonNull default IDocumentNodeItem loadAsNodeItem(@NonNull Format format, @NonNull Path path) throws IOException
      Load data expressed using the provided format and return that data as a Metapath node item.

      The specific Module model is auto-detected by analyzing the source. The class reported is implementation specific.

      Parameters:
      format - the expected format of the data to parse
      path - the resource
      Returns:
      the Metapath node item for the parsed data
      Throws:
      IOException - if an error occurred while loading the data from the specified resource
    • loadAsNodeItem

      @NonNull IDocumentNodeItem loadAsNodeItem(@NonNull Format format, @NonNull URI uri) throws IOException
      Load data expressed using the provided format and return that data as a Metapath node item.

      The specific Module model is auto-detected by analyzing the source. The class reported is implementation specific.

      Parameters:
      format - the expected format of the data to parse
      uri - the resource
      Returns:
      the Metapath node item for the parsed data
      Throws:
      IOException - if an error occurred while loading the data from the specified resource
    • loadAsNodeItem

      @NonNull IDocumentNodeItem loadAsNodeItem(@NonNull Format format, @NonNull InputStream is, @NonNull URI documentUri) throws IOException
      Load data expressed using the provided format and return that data as a Metapath node item.

      The specific Module model is auto-detected by analyzing the source. The class reported is implementation specific.

      Parameters:
      format - the expected format of the data to parse
      is - the resource stream
      documentUri - the URI of the resource
      Returns:
      the Metapath node item for the parsed data
      Throws:
      IOException - if an error occurred while loading the data from the specified resource
    • getBindingContext

      Get the configured Module binding context to use to load Java types.
      Returns:
      the binding context
    • convert

      default <CLASS extends IBoundObject> void convert(@NonNull Path source, @NonNull Path destination, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException
      Auto convert the provided source to the provided toFormat. Write the converted content to the provided destination.

      The format of the source is expected to be auto detected using detectFormat(Path).

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      source - the resource to convert
      destination - the resource to write converted content to
      toFormat - the format to convert to
      rootClass - the class for the Java type to load data into
      Throws:
      FileNotFoundException - the the provided source file was not found
      IOException - if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
    • convert

      default <CLASS extends IBoundObject> void convert(@NonNull Path source, @NonNull OutputStream os, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException
      Auto convert the provided source to the provided toFormat. Write the converted content to the provided destination.

      The format of the source is expected to be auto detected using detectFormat(Path).

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      source - the resource to convert
      os - the output stream to write converted content to
      toFormat - the format to convert to
      rootClass - the class for the Java type to load data into
      Throws:
      FileNotFoundException - the the provided source file was not found
      IOException - if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
    • convert

      default <CLASS extends IBoundObject> void convert(@NonNull URI source, @NonNull Path destination, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException
      Auto convert the provided source to the provided toFormat. Write the converted content to the provided destination.

      The format of the source is expected to be auto detected using detectFormat(Path).

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      source - the resource to convert
      destination - the resource to write converted content to
      toFormat - the format to convert to
      rootClass - the class for the Java type to load data into
      Throws:
      FileNotFoundException - the the provided source file was not found
      IOException - if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
    • convert

      default <CLASS extends IBoundObject> void convert(@NonNull URI source, @NonNull OutputStream os, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException
      Auto convert the provided source to the provided toFormat. Write the converted content to the provided destination.

      The format of the source is expected to be auto detected using detectFormat(Path).

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      source - the resource to convert
      os - the output stream to write converted content to
      toFormat - the format to convert to
      rootClass - the class for the Java type to load data into
      Throws:
      FileNotFoundException - the the provided source file was not found
      IOException - if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination
    • convert

      default <CLASS extends IBoundObject> void convert(@NonNull URI source, @NonNull Writer writer, @NonNull Format toFormat, @NonNull Class<CLASS> rootClass) throws FileNotFoundException, IOException
      Auto convert the provided source to the provided toFormat. Write the converted content to the provided destination.

      The format of the source is expected to be auto detected using detectFormat(Path).

      Type Parameters:
      CLASS - the Java type to load data into
      Parameters:
      source - the resource to convert
      writer - the writer to write converted content to
      toFormat - the format to convert to
      rootClass - the class for the Java type to load data into
      Throws:
      FileNotFoundException - the the provided source file was not found
      IOException - if an error occurred while loading the data from the specified resource or writing the converted data to the specified destination