Interface Configuration.ConfigBuilder<C extends Configuration,​B extends Configuration.ConfigBuilder<C,​B>>

  • Type Parameters:
    C - the type of configuration
    B - the type of builder
    All Known Subinterfaces:
    JdbcConfiguration.Builder
    All Known Implementing Classes:
    Configuration.Builder
    Enclosing interface:
    Configuration

    public static interface Configuration.ConfigBuilder<C extends Configuration,​B extends Configuration.ConfigBuilder<C,​B>>
    The basic interface for configuration builders.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      B apply​(Consumer<B> function)
      Apply the function to this builder.
      C build()
      Build and return the immutable configuration.
      default B changeBoolean​(Field field, Function<Boolean,​Boolean> function)
      Apply the function to this builder to change a potentially existing boolean field.
      default B changeBoolean​(String key, Function<Boolean,​Boolean> function)
      Apply the function to this builder to change a potentially existing boolean field.
      default B changeDouble​(Field field, Function<Double,​Double> function)
      Apply the function to this builder to change a potentially existing double field.
      default B changeDouble​(String key, Function<Double,​Double> function)
      Apply the function to this builder to change a potentially existing double field.
      default B changeFloat​(Field field, Function<Float,​Float> function)
      Apply the function to this builder to change a potentially existing float field.
      default B changeFloat​(String key, Function<Float,​Float> function)
      Apply the function to this builder to change a potentially existing float field.
      default B changeInteger​(Field field, Function<Integer,​Integer> function)
      Apply the function to this builder to change a potentially existing integer field.
      default B changeInteger​(String key, Function<Integer,​Integer> function)
      Apply the function to this builder to change a potentially existing integer field.
      default B changeLong​(Field field, Function<Long,​Long> function)
      Apply the function to this builder to change a potentially existing long field.
      default B changeLong​(String key, Function<Long,​Long> function)
      Apply the function to this builder to change a potentially existing long field.
      B changeString​(Field field, Function<String,​String> function)
      Apply the function to this builder to change a potentially existing string field.
      B changeString​(String key, Function<String,​String> function)
      Apply the function to this builder to change a potentially existing string field.
      default B with​(Configuration other)
      Add all of the fields in the supplied Configuration object.
      default B with​(Field field, boolean value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, double value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, float value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, int value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, long value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, EnumeratedValue value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, Class<?> value)
      Associate the given class name value with the specified field.
      default B with​(Field field, Object value)
      Associate the given value with the key of the specified field.
      default B with​(Field field, String value)
      Associate the given value with the key of the specified field.
      default B with​(String key, boolean value)
      Associate the given value with the specified key.
      default B with​(String key, double value)
      Associate the given value with the specified key.
      default B with​(String key, float value)
      Associate the given value with the specified key.
      default B with​(String key, int value)
      Associate the given value with the specified key.
      default B with​(String key, long value)
      Associate the given value with the specified key.
      default B with​(String key, EnumeratedValue value)
      Associate the given value with the specified key.
      default B with​(String key, Class<?> value)
      Associate the given class name value with the specified key.
      default B with​(String key, Object value)
      Associate the given value with the specified key.
      B with​(String key, String value)
      Associate the given value with the specified key.
      default B withDefault​(Configuration other)
      If any of the fields in the supplied Configuration object do not exist, then add them.
      default B withDefault​(Field field, boolean value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, double value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, float value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, int value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, long value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, Class<?> value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, Object value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(Field field, String value)
      If the field does not have a value, then associate the given value with the key of the specified field.
      default B withDefault​(String key, boolean value)
      If there is no field with the specified key, then associate the given value with the specified key.
      default B withDefault​(String key, double value)
      If there is no field with the specified key, then associate the given value with the specified key.
      default B withDefault​(String key, float value)
      If there is no field with the specified key, then associate the given value with the specified key.
      default B withDefault​(String key, int value)
      If there is no field with the specified key, then associate the given value with the specified key.
      default B withDefault​(String key, long value)
      If there is no field with the specified key, then associate the given value with the specified key.
      default B withDefault​(String key, EnumeratedValue value)
      If there is no field with the specified key, then associate the given value with the specified key.
      default B withDefault​(String key, Class<?> value)
      If there is no field with the specified key, then associate the given class name value with the specified key.
      default B withDefault​(String key, Object value)
      If there is no field with the specified key, then associate the given value with the specified key.
      B withDefault​(String key, String value)
      If there is no field with the specified key, then associate the given value with the specified key.
    • Method Detail

      • with

        B with​(String key,
               String value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       Object value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       EnumeratedValue value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       int value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       float value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       double value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       long value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       boolean value)
        Associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(String key,
                       Class<?> value)
        Associate the given class name value with the specified key.
        Parameters:
        key - the key
        value - the Class value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        B withDefault​(String key,
                      String value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              Object value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              EnumeratedValue value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              int value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              float value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              double value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              long value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              boolean value)
        If there is no field with the specified key, then associate the given value with the specified key.
        Parameters:
        key - the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(String key,
                              Class<?> value)
        If there is no field with the specified key, then associate the given class name value with the specified key.
        Parameters:
        key - the key
        value - the Class value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Configuration other)
        If any of the fields in the supplied Configuration object do not exist, then add them.
        Parameters:
        other - the configuration whose fields should be added; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Configuration other)
        Add all of the fields in the supplied Configuration object.
        Parameters:
        other - the configuration whose fields should be added; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       String value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       Object value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       EnumeratedValue value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       int value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       float value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       double value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       long value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       boolean value)
        Associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • with

        default B with​(Field field,
                       Class<?> value)
        Associate the given class name value with the specified field.
        Parameters:
        field - the predefined field for the key
        value - the Class value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              String value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              Object value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              int value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              float value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              double value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              long value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              boolean value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the default value
        Returns:
        this builder object so methods can be chained together; never null
      • withDefault

        default B withDefault​(Field field,
                              Class<?> value)
        If the field does not have a value, then associate the given value with the key of the specified field.
        Parameters:
        field - the predefined field for the key
        value - the default value
        Returns:
        this builder object so methods can be chained together; never null
      • apply

        B apply​(Consumer<B> function)
        Apply the function to this builder.
        Parameters:
        function - the predefined field for the key
        Returns:
        this builder object so methods can be chained together; never null
      • changeBoolean

        default B changeBoolean​(String key,
                                Function<Boolean,​Boolean> function)
        Apply the function to this builder to change a potentially existing boolean field.
        Parameters:
        key - the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
        Throws:
        NumberFormatException - if the existing value is not a boolean
      • changeString

        B changeString​(String key,
                       Function<String,​String> function)
        Apply the function to this builder to change a potentially existing string field.
        Parameters:
        key - the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • changeDouble

        default B changeDouble​(String key,
                               Function<Double,​Double> function)
        Apply the function to this builder to change a potentially existing double field.
        Parameters:
        key - the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
        Throws:
        NumberFormatException - if the existing value is not a double
      • changeFloat

        default B changeFloat​(String key,
                              Function<Float,​Float> function)
        Apply the function to this builder to change a potentially existing float field.
        Parameters:
        key - the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
        Throws:
        NumberFormatException - if the existing value is not a float
      • changeLong

        default B changeLong​(String key,
                             Function<Long,​Long> function)
        Apply the function to this builder to change a potentially existing long field.
        Parameters:
        key - the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
        Throws:
        NumberFormatException - if the existing value is not a long
      • changeInteger

        default B changeInteger​(String key,
                                Function<Integer,​Integer> function)
        Apply the function to this builder to change a potentially existing integer field.
        Parameters:
        key - the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
        Throws:
        NumberFormatException - if the existing value is not an integer
      • changeBoolean

        default B changeBoolean​(Field field,
                                Function<Boolean,​Boolean> function)
        Apply the function to this builder to change a potentially existing boolean field.
        Parameters:
        field - the predefined field for the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • changeString

        B changeString​(Field field,
                       Function<String,​String> function)
        Apply the function to this builder to change a potentially existing string field.
        Parameters:
        field - the predefined field for the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • changeDouble

        default B changeDouble​(Field field,
                               Function<Double,​Double> function)
        Apply the function to this builder to change a potentially existing double field.
        Parameters:
        field - the predefined field for the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • changeFloat

        default B changeFloat​(Field field,
                              Function<Float,​Float> function)
        Apply the function to this builder to change a potentially existing float field.
        Parameters:
        field - the predefined field for the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • changeLong

        default B changeLong​(Field field,
                             Function<Long,​Long> function)
        Apply the function to this builder to change a potentially existing long field.
        Parameters:
        field - the predefined field for the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • changeInteger

        default B changeInteger​(Field field,
                                Function<Integer,​Integer> function)
        Apply the function to this builder to change a potentially existing integer field.
        Parameters:
        field - the predefined field for the key
        function - the function that computes the new value given a possibly-existing value; may not be null
        Returns:
        this builder object so methods can be chained together; never null
      • build

        C build()
        Build and return the immutable configuration.
        Returns:
        the immutable configuration; never null