Interface ConfigSupplier<M extends PMessage<M>>

    • Method Detail

      • reference

        <RM extends PMessage<RM>> ConfigSupplier<RM> reference​(PField... fields)
                                                        throws ConfigException
        Give a reference to a sub-config based on field selection.
        Type Parameters:
        RM - The resulting config type.
        Parameters:
        fields - The fields to select.
        Returns:
        The reference config supplier.
        Throws:
        ConfigException - If resolving fields failed
      • override

        default ConfigSupplier<M> override​(java.util.Map<java.lang.String,​java.lang.String> overrides)
                                    throws ConfigException
        Get config with single-field overrides based on the current config.
        Parameters:
        overrides - Map of field value overrides.
        Returns:
        Config with overrides.
        Throws:
        ConfigException - If the overrides are invalid.
      • override

        default ConfigSupplier<M> override​(java.util.Map<java.lang.String,​java.lang.String> overrides,
                                           boolean strict)
                                    throws ConfigException
        Get config with single-field overrides based on the current config.
        Parameters:
        overrides - Map of field value overrides.
        strict - If the overrides should be checked strictly.
        Returns:
        Config with overrides.
        Throws:
        ConfigException - If the overrides are invalid.
      • snapshot

        default ConfigSupplier<M> snapshot()
        Get a snapshot of the current config.
        Returns:
        Non-modifiable supplier of current config containing a snapshot.
      • addListener

        void addListener​(@Nonnull
                         ConfigListener<M> listener)
        Add a listener to changes to this config. Note that this will store a weak reference to the listener instance, so the one adding the listener must make sure the listener is not GC'd.
        Parameters:
        listener - The config change listener to be added.
      • removeListener

        void removeListener​(@Nonnull
                            ConfigListener<M> listener)
        Remove a config change listener.
        Parameters:
        listener - The config change listener to be removed.
      • getName

        java.lang.String getName()
        Get a simple descriptive name for this config supplier.
        Returns:
        The supplier name.
      • configTimestamp

        long configTimestamp()
        Get the last update time as a millisecond timestamp.
        Returns:
        The timestamp of last update of the config.
      • getClock

        java.time.Clock getClock()
        Returns:
        Get the clock used to calculate config timestamp.