Interface ConfigurationLoader<N extends ConfigurationNode>
-
- Type Parameters:
N
- theConfigurationNode
type produced by the loader
- All Superinterfaces:
ConfigurationNodeFactory<N>
- All Known Implementing Classes:
AbstractConfigurationLoader
,GsonConfigurationLoader
,HoconConfigurationLoader
,JacksonConfigurationLoader
,XmlConfigurationLoader
,YamlConfigurationLoader
public interface ConfigurationLoader<N extends ConfigurationNode> extends ConfigurationNodeFactory<N>
Represents an object which can load and saveConfigurationNode
objects in a specific configuration format.An abstract implementation is provided by
AbstractConfigurationLoader
.- Since:
- 4.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
canLoad()
Gets if this loader is capable of loading configurations.default boolean
canSave()
Gets if this loader is capable of saving configurations.default N
load()
Attempts to load aConfigurationNode
using this loader, from the defined source.N
load(ConfigurationOptions options)
Attempts to load aConfigurationNode
using this loader, from the defined source.ConfigurationReference<N>
loadToReference()
Attempts to load data from the defined source into aConfigurationReference
.void
save(ConfigurationNode node)
Attempts to save aConfigurationNode
using this loader, to the defined sink.-
Methods inherited from interface org.spongepowered.configurate.ConfigurationNodeFactory
createNode, createNode, createNode, createNode, defaultOptions, toListCollector, toListCollector, toMapCollector, toMapCollector
-
-
-
-
Method Detail
-
load
default N load() throws ConfigurateException
Attempts to load aConfigurationNode
using this loader, from the defined source.The resultant node represents the root of the configuration being loaded.
The
default options
will be used to construct the resultant configuration nodes.- Returns:
- the newly constructed node
- Throws:
ConfigurateException
- if any sort of error occurs with reading or parsing the configuration- Since:
- 4.0.0
-
load
N load(ConfigurationOptions options) throws ConfigurateException
Attempts to load aConfigurationNode
using this loader, from the defined source.The resultant node represents the root of the configuration being loaded.
- Parameters:
options
- the options to load with- Returns:
- the newly constructed node
- Throws:
ConfigurateException
- if any sort of error occurs with reading or parsing the configuration- Since:
- 4.0.0
-
loadToReference
ConfigurationReference<N> loadToReference() throws ConfigurateException
Attempts to load data from the defined source into aConfigurationReference
. The returned reference will not reload automatically.- Returns:
- the created reference
- Throws:
ConfigurateException
- when an error occurs within the loader- Since:
- 4.0.0
- See Also:
to create an auto-reloading configuration.
-
save
void save(ConfigurationNode node) throws ConfigurateException
Attempts to save aConfigurationNode
using this loader, to the defined sink.- Parameters:
node
- the node to save- Throws:
ConfigurateException
- if any sort of error occurs with writing or generating the configuration- Since:
- 4.0.0
-
canLoad
default boolean canLoad()
Gets if this loader is capable of loading configurations.- Returns:
- if this loader can load
- Since:
- 4.0.0
-
canSave
default boolean canSave()
Gets if this loader is capable of saving configurations.- Returns:
- if this loader can save
- Since:
- 4.0.0
-
-