Interface Configuration


public interface Configuration
  • Method Details

    • get

      <T> T get(Configuration.Option<T> option)
      Retrieve the currently configured value of the provided option. Note, this operation involves a map lookup and shouldn't be used in performance critical or frequently accessed code paths. In such instances, prefer instead getValueSupplier(Option) or one of the other functions that returns a supplier.
    • getValueSupplier

      <T> Supplier<T> getValueSupplier(Configuration.Option<T> option)
      Retrieve a supplier that is always up to date with the latest configured value. Retrieving the value from the returned supplier is quick and can be used in performance critical areas.
    • getIntSupplier

      Supplier<Integer> getIntSupplier(Configuration.Option<Number> option)
      Retrieve a supplier that is always up to date with the latest configured value. Retrieving the value from the returned supplier is quick and can be used in performance critical areas.
    • getLongSupplier

      Supplier<Long> getLongSupplier(Configuration.Option<Number> option)
      Retrieve a supplier that is always up to date with the latest configured value. Retrieving the value from the returned supplier is quick and can be used in performance critical areas.
    • getDoubleSupplier

      Supplier<Double> getDoubleSupplier(Configuration.Option<Number> option)
      Retrieve a supplier that is always up to date with the latest configured value. Retrieving the value from the returned supplier is quick and can be used in performance critical areas.
    • listen

      <T> void listen(Configuration.Option<T> option, Consumer<T> listener, Boolean sendImmediately)
      Register a consumer to be invoked when the given configuration option changes value. Note that the consumer is held as a strong reference, so do not register a consumer that is expected to fall out of scope. Because of this restriction, use this method only when the other forms of access are insufficient.
      Parameters:
      option - The configuration option to listen to for changes.
      listener - The callback to run when the option changes.
      sendImmediately - If true, the consumer will be immediately invoked with the current value of the configuration option.
    • listen

      default <T> void listen(Configuration.Option<T> option, Consumer<T> listener)
    • listenToAll

      <T> void listenToAll(Configuration.Listener<T> listener)
      Register a callback that will be invoked when any configuration option changes value. Note that the listener is held as a strong reference, so do not register a listener that is expected to fall out of scope. Because of this restriction, use this method only when the other forms of access are insufficient. Note: The listener will _not_ be immediately invoked with the current value of any configuration options. Rather, the listener will be invoked on any changes going forward.
    • stringOption

      static Configuration.Option<String> stringOption(String path)
    • numberOption

      static Configuration.Option<Number> numberOption(String path)
    • booleanOption

      static Configuration.Option<Boolean> booleanOption(String path)
    • wireThreadPoolSizeToConfiguration

      default void wireThreadPoolSizeToConfiguration(Configuration.Option<Number> option, ThreadPoolExecutor pool)
    • getAllOptions

      static Map<String,Configuration.Option<?>> getAllOptions()