Class Configuration

java.lang.Object
org.meeuw.configuration.Configuration

public class Configuration extends Object
Immutable object containing all ConfigurationAspects.
Since:
0.4
Author:
Michiel Meeuwissen
  • Method Details

    • getAspect

      public <E extends ConfigurationAspect> E getAspect(Class<E> clazz)
      Returns the aspect with given class.
      Type Parameters:
      E - the type of the configuration aspect
      Parameters:
      clazz - the class of the configuration aspect
      Returns:
      the configuration aspect instance of that class currently configured in this configuration object
    • getAspectValue

      public <E extends ConfigurationAspect, V> V getAspectValue(Class<E> clazz, Function<E,V> getter)
      Gets a value of a certain configuration aspect
      Type Parameters:
      E - the type of the configuration aspect
      Parameters:
      clazz - the class of the configuration aspect
      getter - a function to get the value from the instance of the aspect (probably a method reference)
      Returns:
      the request configuration aspect value
    • with

      public <E extends ConfigurationAspect> Configuration with(Class<E> clazz, UnaryOperator<E> config)
      Type Parameters:
      E - the type of the class
      Parameters:
      clazz - The configuration aspect class
      config - The operator that given the exising value for the aspect, produces a new one
      Returns:
      a new Configuration with a changed ConfigurationAspect
    • getConfigurationAspectsAssociatedWith

      public List<ConfigurationAspect> getConfigurationAspectsAssociatedWith(Class<?> clazz)
    • toBuilder

      public Configuration.Builder toBuilder()
    • builder

      public static Configuration.Builder builder()