Package 

Interface KeyValueConfigurerFactory

  • All Implemented Interfaces:

    
    public interface KeyValueConfigurerFactory
    
                        

    Defines contract for building KeyValueConfigurer instances. The main idea is that it receives Map<String, Any> which holds configuration rules and builds KeyValueConfigurer based on that.

    DSL: For simplicity all examples below show YAML config, however, there is no restriction on where it comes from.

    Unconditional static configuration

    rules:
      key1: value1
      key2: value2

    This is the simplest possible configuration - target values are defined for the target keys.

    Conditional static configuration with leaf static rules

    rules:
      key1:
        - When:
            key2: some-value
          Then: value1
        - When:
            key3: some-other-value
          Then: value2
        - Then: value3

    Note: if there is no final unconditional 'Then' clause, then key1 value is not set

    Composite AND filter

    rules:
      key1:
        - When:
            key2: some-value
          Then: value1
        - When:
            And:
              - key3: some-other-value
              - key4: one-more-value
          Then: value2

    Composite OR filter

    rules:
      key1:
        - When:
            Or:
              - key2: some-value
              - And:
                  key3: some-other-value
                  key4: one-more-value
          Then: value
    • If key2 = some-value or (key3 = some-other-value and key4 = one-more-value) then key1 is set to value

    • Else key1 value is not set/changed

    Note: any other filter might be used in AND/OR filters

    Dynamic value with static key

    rules:
      key1:
        - When:
            key2: 3
          Then: <original-key3>

    Note: here and below all elements in angle brackets (<>) mean something dynamic. Here we use a dedicated original- prefix as an indication that dynamic value should be retrieved via target static key

    Dynamic value with static key shorthand

    rules:
      key1:
        - When:
            key2: 3
          Then: 4
        - Then: <original>
    • If key2 = 3 then key1 is set to 4

    • Else key1 is set to key1 dynamic value

    Note: key1: <original> is the same as key1: <original-key1>

    Dynamic value with dynamic key

    rules:
      key1:
        - When:
            key2: <flavor1>
          Then: <flavor2>

    Dynamic key

    rules:
      key1:
        - When:
            <flow>: flow1
          Then: value1
        - When:
            key2: value2
          Then: value3

    Rich string value with dynamic value by static key

    rules:
      key1:
        - When:
            key2: 1
          Then: "prefix <original-key3> suffix"
    • If key1 type is string and key2 = 1 then set key1 value as string prefix 'dynamic key3 value' suffix

    • Else key1 value is not set/changed

    Rich string value with dynamic value by dynamic key

    rules:
      key1:
        - When:
            key2: 1
          Then: "prefix <flow> suffix"
    • If key1 type is string and key2 = 1 then set key1 value as string prefix 'dynamic flow value' suffix

    • Else key1 value is not set/changed

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description