- java.lang.Object
-
- org.github.gestalt.config.loader.PropertyLoader
-
- All Implemented Interfaces:
ConfigLoader
public final class PropertyLoader extends java.lang.Object implements ConfigLoader
Loads from a property files from multiple sources, such as a file.
-
-
Constructor Summary
Constructors Constructor Description PropertyLoader()Construct a default property loader using the default path lexer for "." separated paths.PropertyLoader(SentenceLexer lexer, ConfigParser parser)Construct a property loader providing a lexer and a config parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(java.lang.String format)True if the config loader accepts the format.GResultOf<java.util.List<ConfigNodeContainer>>loadSource(ConfigSource source)Loads the source with a stream into a java Properties class.java.lang.Stringname()Name of the config loader.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.github.gestalt.config.loader.ConfigLoader
applyConfig
-
-
-
-
Constructor Detail
-
PropertyLoader
public PropertyLoader()
Construct a default property loader using the default path lexer for "." separated paths.
-
PropertyLoader
public PropertyLoader(SentenceLexer lexer, ConfigParser parser)
Construct a property loader providing a lexer and a config parser.- Parameters:
lexer- SentenceLexer to create tokens for the path.parser- Parser for the property files
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:ConfigLoaderName of the config loader.- Specified by:
namein interfaceConfigLoader- Returns:
- name
-
accepts
public boolean accepts(java.lang.String format)
Description copied from interface:ConfigLoaderTrue if the config loader accepts the format.- Specified by:
acceptsin interfaceConfigLoader- Parameters:
format- config format.- Returns:
- True if the config loader accepts the format.
-
loadSource
public GResultOf<java.util.List<ConfigNodeContainer>> loadSource(ConfigSource source) throws GestaltException
Loads the source with a stream into a java Properties class. Then convert them to a list of pairs with the path and value. Pass these into the ConfigCompiler to build a config node tree.- Specified by:
loadSourcein interfaceConfigLoader- Parameters:
source- source we want to load with this config loader.- Returns:
- GResultOf config node or errors.
- Throws:
GestaltException- any errors.
-
-