Interface ConfigurationFormat
- All Known Implementing Classes:
AbstractConfigurationFormat
,GsonConfigurationFormat
,HoconConfigurationFormat
,JacksonConfigurationFormat
,XmlConfigurationFormat
,YamlConfigurationFormat
public interface ConfigurationFormat
A service provider interface declaring a specific configuration format.
This is a service interface, designed to be implemented by modules
that provide a ConfigurationLoader
implementation. Service discovery
follows the rules laid out in ServiceLoader
.
- Since:
- 4.2.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault ConfigurationLoader<? extends @NonNull Object>
Create a new loader configured to load from the provided URL, with default style options.ConfigurationLoader<? extends @NonNull Object>
create
(URL url, ConfigurationNode options) Create a new loader configured to load from the provided URL.default ConfigurationLoader<? extends @NonNull Object>
Create a new loader configured to load from the provided file, with default style options.ConfigurationLoader<? extends @NonNull Object>
create
(Path file, ConfigurationNode options) Create a new loader configured to load from the provided file.static @Nullable ConfigurationFormat
forExtension
(String extension) Get a configuration format that can handle the specified extension.id()
An identifier describing this loader.Get the file extensions known to be supported by this format.static Set<ConfigurationFormat>
Get all supported configuration formats.
-
Method Details
-
forExtension
Get a configuration format that can handle the specified extension.If a format fails to load, it will be ignored when p
- Parameters:
extension
- the extension to handle- Returns:
- a format, or
null
if none is known - Since:
- 4.2.0
-
supportedFormats
Get all supported configuration formats.If any exceptions were thrown while discovering or loading configuration format services, they will be rethrown on calling this method.
- Returns:
- all known formats
- Since:
- 4.2.0
-
id
An identifier describing this loader.This should match the naming used in other locations, such as the loader's artifact ID or class name.
- Returns:
- the loader identifier
- Since:
- 4.2.0
-
supportedExtensions
Get the file extensions known to be supported by this format.- Returns:
- the supported extensions
- Since:
- 4.2.0
-
create
Create a new loader configured to load from the provided file, with default style options.- Parameters:
file
- the file to load from- Returns:
- a newly configured loader
- Since:
- 4.2.0
-
create
Create a new loader configured to load from the provided file.- Parameters:
file
- the file to load fromoptions
- the options to use to configure the node- Returns:
- a newly configured loader
- Since:
- 4.2.0
-
create
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
- Parameters:
url
- the URL to load from- Returns:
- a newly configured loader
- Since:
- 4.2.0
-
create
Create a new loader configured to load from the provided URL.This loader may not be able to write to the given URL.
- Parameters:
url
- the URL to load fromoptions
- the options to use to configure the node- Returns:
- a newly configured loader
- Since:
- 4.2.0
-