Class ProvidenceConfig

  • All Implemented Interfaces:
    ConfigResolver

    public class ProvidenceConfig
    extends java.lang.Object
    implements ConfigResolver
    Providence config loader. This loads providence configs.
    • Constructor Detail

      • ProvidenceConfig

        public ProvidenceConfig​(TypeRegistry registry)
        Make a non-strict config instance.
        Parameters:
        registry - The type registry used to find message and enum types.
      • ProvidenceConfig

        public ProvidenceConfig​(@Nonnull
                                TypeRegistry registry,
                                @Nullable
                                net.morimekta.util.FileWatcher watcher,
                                boolean strict)
        Make a config instance.
        Parameters:
        registry - The type registry used to find message and enum types.
        watcher - File watcher used to detect config file updates.
        strict - If the config should be parsed strictly.
      • ProvidenceConfig

        public ProvidenceConfig​(@Nonnull
                                TypeRegistry registry,
                                @Nullable
                                net.morimekta.util.FileWatcher watcher,
                                boolean strict,
                                @Nonnull
                                java.time.Clock clock)
        Make a config instance.
        Parameters:
        registry - The type registry used to find message and enum types.
        watcher - File watcher used to detect config file updates.
        strict - If the config should be parsed strictly.
        clock - The clock to use in timing config loads.
    • Method Detail

      • getConfig

        @Nonnull
        public <M extends PMessage<M,F>,F extends PField> M getConfig​(@Nonnull
                                                                      java.io.File configFile)
                                                               throws ProvidenceConfigException
        Get config for the given file.
        Type Parameters:
        M - The config message type.
        F - The config message field type.
        Parameters:
        configFile - The file to read config for.
        Returns:
        The config message.
        Throws:
        ProvidenceConfigException - On config load failure.
      • getConfig

        @Nonnull
        public <M extends PMessage<M,F>,F extends PField> M getConfig​(@Nonnull
                                                                      java.io.File configFile,
                                                                      @Nonnull
                                                                      M parent)
                                                               throws ProvidenceConfigException
        Get config for the given with parent.
        Type Parameters:
        M - The config message type.
        F - The config message field type.
        Parameters:
        configFile - The file to read config for.
        parent - The designated parent config.
        Returns:
        The config message.
        Throws:
        ProvidenceConfigException - On config load failure.