Class AbstractConfigurationFormat<N extends ScopedConfigurationNode<N>,​L extends AbstractConfigurationLoader<N>,​B extends AbstractConfigurationLoader.Builder<B,​L>>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractConfigurationFormat​(java.lang.String id, java.util.function.Supplier<B> builderMaker, java.util.Set<java.lang.String> supportedExtensions)
      Create a new configuration format.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.net.URL url)
      Create a new loader configured to load from the provided URL, with default style options.
      ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.net.URL url, ConfigurationNode options)
      Create a new loader configured to load from the provided URL.
      ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.nio.file.Path file)
      Create a new loader configured to load from the provided file, with default style options.
      ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.nio.file.Path file, ConfigurationNode options)
      Create a new loader configured to load from the provided file.
      java.lang.String id()
      An identifier describing this loader.
      java.util.Set<java.lang.String> supportedExtensions()
      Get the file extensions known to be supported by this format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractConfigurationFormat

        protected AbstractConfigurationFormat​(java.lang.String id,
                                              java.util.function.Supplier<B> builderMaker,
                                              java.util.Set<java.lang.String> supportedExtensions)
        Create a new configuration format.

        Subclasses should have a zero-argument constructor to fulfil the requirements of ServiceLoader.

        Parameters:
        builderMaker - a factory creating a new builder
        supportedExtensions - the file extensions associated with this format
        Since:
        4.2.0
    • Method Detail

      • id

        public java.lang.String id()
        Description copied from interface: ConfigurationFormat
        An identifier describing this loader.

        This should match the naming used in other locations, such as the loader's artifact ID or class name.

        Specified by:
        id in interface ConfigurationFormat
        Returns:
        the loader identifier
      • create

        public ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.nio.file.Path file)
        Description copied from interface: ConfigurationFormat
        Create a new loader configured to load from the provided file, with default style options.
        Specified by:
        create in interface ConfigurationFormat
        Parameters:
        file - the file to load from
        Returns:
        a newly configured loader
      • create

        public ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.nio.file.Path file,
                                                                               ConfigurationNode options)
        Description copied from interface: ConfigurationFormat
        Create a new loader configured to load from the provided file.
        Specified by:
        create in interface ConfigurationFormat
        Parameters:
        file - the file to load from
        options - the options to use to configure the node
        Returns:
        a newly configured loader
      • create

        public ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.net.URL url)
        Description copied from interface: ConfigurationFormat
        Create a new loader configured to load from the provided URL, with default style options.

        This loader may not be able to write to the given URL

        Specified by:
        create in interface ConfigurationFormat
        Parameters:
        url - the URL to load from
        Returns:
        a newly configured loader
      • create

        public ConfigurationLoader<? extends @NonNull java.lang.Object> create​(java.net.URL url,
                                                                               ConfigurationNode options)
        Description copied from interface: ConfigurationFormat
        Create a new loader configured to load from the provided URL.

        This loader may not be able to write to the given URL.

        Specified by:
        create in interface ConfigurationFormat
        Parameters:
        url - the URL to load from
        options - the options to use to configure the node
        Returns:
        a newly configured loader