Class 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
      boolean accepts​(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.String name()
      Name of the config loader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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: ConfigLoader
        Name of the config loader.
        Specified by:
        name in interface ConfigLoader
        Returns:
        name
      • accepts

        public boolean accepts​(java.lang.String format)
        Description copied from interface: ConfigLoader
        True if the config loader accepts the format.
        Specified by:
        accepts in interface ConfigLoader
        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:
        loadSource in interface ConfigLoader
        Parameters:
        source - source we want to load with this config loader.
        Returns:
        GResultOf config node or errors.
        Throws:
        GestaltException - any errors.