Class ConfigurationService

java.lang.Object
org.meeuw.configuration.ConfigurationService

public class ConfigurationService extends Object
Since:
0.7
  • Field Details

  • Method Details

    • defaultConfiguration

      public static void defaultConfiguration(Consumer<Configuration.Builder> consumer)
      Configures the default configuration object.
      Parameters:
      consumer - the code to configure the new default configuration. it will receive a Configuration.Builder with the existing configuration.
    • getConfiguration

      public static Configuration getConfiguration()
      Returns:
      the current (thread local) configuration object
    • setConfiguration

      public static void setConfiguration(Configuration configuration)
      Sets the given configuration object as a thread local
      Parameters:
      configuration - the new configuration
    • resetToDefaults

      public static void resetToDefaults()
      Unsets the configuration thread local, effectively resetting it the default settings.
    • resetToDefaultDefaults

      public static void resetToDefaultDefaults()
    • getConfigurationAspect

      public static <E extends ConfigurationAspect> E getConfigurationAspect(Class<E> clazz)
      Type Parameters:
      E - The type of the aspect to obtain
      Parameters:
      clazz - the class of the aspect to obtain
      Returns:
      an aspect of the current configuration object
    • with

      public static void with(Configuration configuration, Runnable r)
    • with

      public static <E extends ConfigurationAspect, R> R with(Class<E> configurationAspect, UnaryOperator<E> aspect, Supplier<R> r)
    • with

      public static <E extends ConfigurationAspect> void with(Class<E> configurationAspect, UnaryOperator<E> aspect, Runnable r)
    • with

      public static <R> R with(Configuration configuration, Supplier<R> r)
      Executes code with a certain configuration
    • with

      public static void with(Consumer<Configuration.Builder> configuration, Runnable r)
    • newConfigurationMap

      public static FixedSizeMap<Class<? extends ConfigurationAspect>,ConfigurationAspect> newConfigurationMap()