Interface KeyValueConfigurer
-
- All Implemented Interfaces:
public interface KeyValueConfigurer<K extends Object>Stateless modification strategy for any given DataModificationStrategy. It can hold static setup like
key1 = value1andkey2 = value2, then the data is applied to the given key-values holder.However, there is a possible case that we want to apply rules based on some dynamic runtime state. For example, we receive an event to process and want to create new event based on it. We might define the configuration rules as below:
if received event's
user' attribute value is equal touser1then create new event withuser = user12`if received event's
user' attribute value is equal touser2then create new event withuser = user22`else use
user = user3
Such dynamic behavior is implemented via given context - it holds dynamic info to be consulted during given key-value holder modification. Every implementation of this interface is bound to particular type of context.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classKeyValueConfigurer.Companion
-
Method Summary
Modifier and Type Method Description abstract Unitconfigure(DataModificationStrategy<K> toConfigure, KeyValueConfigurationContext<K> context)abstract Set<K>getKeys()Set of keys which might be asked from the context during target value configuration or used as DataModificationStrategy.setValue parameter. abstract Map<K, Set<Object>>getStaticConfiguration()Shows all possible static configuration which can be done by the current configurer. -
-
Method Detail
-
configure
abstract Unit configure(DataModificationStrategy<K> toConfigure, KeyValueConfigurationContext<K> context)
-
getKeys
abstract Set<K> getKeys()
Set of keys which might be asked from the context during target value configuration or used as DataModificationStrategy.setValue parameter.
-
getStaticConfiguration
abstract Map<K, Set<Object>> getStaticConfiguration()
Shows all possible static configuration which can be done by the current configurer. For example, consider setup like below:
key1: value1 key2: value2This property would expose
mapOf("key1" to setOf("value1"), "key2" to setOf("value2"))then;key1: - When: key3: value31 Then: value11 - Then: value12 key2: value2This property would expose
mapOf("key1" to setOf("value11", "value12"), "key2" to setOf("value2"))then.
-
-
-
-