Package io.openlineage.client
Interface MergeConfig<T>
-
- All Known Implementing Classes:
DatasetConfig
,FacetsConfig
,HostListNamespaceResolverConfig
,HttpConfig
,JavaRuntimeCircuitBreakerConfig
,KafkaConfig
,KinesisConfig
,OpenLineageConfig
,PatternMatchingGroupNamespaceResolverConfig
,PatternNamespaceResolverConfig
,SimpleMemoryCircuitBreakerConfig
public interface MergeConfig<T>
Contains methods to merge different config classes. It is mainly used to merge config entries from YAML files with config entries provided in another way (like integration specific configuration mechanism: SparkConf, FlinkConf).The general behaviour for classes implementing it is: implement a method that allows creating new config class which merges each property. When merging a non-value is taken and if two values are present then the argument of a method has higher precedence. If a property implements MergeConfig interface, then interface method is called. Merging logic needs to be aware of default values so that it does not overwrite a value with default entry.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.Map
mergePropertyWith(java.util.Map base, java.util.Map overwrite)
Creates union of maps.default <T> T
mergePropertyWith(T base, T overwrite)
Checks for nulls to avoid NPE.default T
mergeWith(T t)
Merges current instance with instance provided.default <T> T
mergeWithDefaultValue(T base, T overwrite, T def)
Overwrites base value with overwrite value only when it is does not equal defaultT
mergeWithNonNull(T t)
Method to create new config class based on current instance and non-null argument value.
-
-
-
Method Detail
-
mergeWith
default T mergeWith(T t)
Merges current instance with instance provided. Checks if argument provided is non-null.- Parameters:
t
- object to be merged with- Returns:
- merged value
-
mergePropertyWith
default java.util.Map mergePropertyWith(java.util.Map base, java.util.Map overwrite)
Creates union of maps. In case of key collision, second parameter overwrites the first. Does null checking to avoid NPE- Parameters:
base
- base valueoverwrite
- overwrite value- Returns:
- merged map
-
mergePropertyWith
default <T> T mergePropertyWith(T base, T overwrite)
Checks for nulls to avoid NPE. If arguments are of different classes, the latter is returned. If they implement MergeConfig interface, then interface methods are used to merge values.- Type Parameters:
T
- generic type of merged object- Parameters:
base
- base valueoverwrite
- overwrite value- Returns:
- merged config entry
-
mergeWithDefaultValue
default <T> T mergeWithDefaultValue(T base, T overwrite, T def)
Overwrites base value with overwrite value only when it is does not equal default- Type Parameters:
T
- generic type of merged object- Parameters:
base
- base valueoverwrite
- overwrite valuedef
- default value- Returns:
- merged object
-
-