Class ConfigParser


  • public class ConfigParser
    extends java.lang.Object
    This parser parses config files. The class in itself should be stateless, so can safely be used in multiple threads safely. This is a utility class created in order to simplify testing.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigParser​(net.morimekta.providence.types.TypeRegistry registry, ContentResolver contentResolver, java.util.function.Consumer<ConfigWarning> warningHandler, boolean strict)
      Create a providence config parser instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <M extends net.morimekta.providence.PMessage<M>>
      net.morimekta.util.Pair<M,​java.util.Set<java.lang.String>>
      parseConfig​(java.nio.file.Path configFile, M parent)
      Parse a providence config into a message.
      • Methods inherited from class java.lang.Object

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

      • ConfigParser

        public ConfigParser​(net.morimekta.providence.types.TypeRegistry registry,
                            ContentResolver contentResolver,
                            java.util.function.Consumer<ConfigWarning> warningHandler,
                            boolean strict)
        Create a providence config parser instance.
        Parameters:
        registry - The type registry used.
        contentResolver - Content resolver.
        warningHandler - Handle parse warnings.
        strict - If config should be parsed and handled strictly.
    • Method Detail

      • parseConfig

        @Nonnull
        public <M extends net.morimekta.providence.PMessage<M>> net.morimekta.util.Pair<M,​java.util.Set<java.lang.String>> parseConfig​(@Nonnull
                                                                                                                                             java.nio.file.Path configFile,
                                                                                                                                             @Nullable
                                                                                                                                             M parent)
                                                                                                                                      throws ConfigException
        Parse a providence config into a message.
        Type Parameters:
        M - The config message type.
        Parameters:
        configFile - The config file to be parsed.
        parent - The parent config message.
        Returns:
        Pair of parsed config and set of included file paths.
        Throws:
        ConfigException - If parsing failed.