1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00

consolidate marge methods

This commit is contained in:
Christopher Fenner 2018-02-06 08:41:28 +01:00
parent 0566cab5db
commit 6e3bfac5c8

View File

@ -7,11 +7,7 @@ import com.sap.piper.MapUtils
class ConfigurationMerger { class ConfigurationMerger {
@NonCPS @NonCPS
def static merge(Map configs, List configKeys, Map defaults=[:]) { def static merge(Map configs, List configKeys, Map defaults=[:]) {
Map merged = [:] return merge(configs, MapUtils.fromList(configKeys), defaults)
merged.putAll(defaults)
merged.putAll(filterByKeyAndNull(configs, configKeys))
return merged
} }
@NonCPS @NonCPS
@ -31,11 +27,15 @@ class ConfigurationMerger {
} }
@NonCPS @NonCPS
def static merge(Map parameters, List parameterKeys, Map configurationMap, List configurationKeys, Map defaults=[:]){ def static merge(
Map merged = merge(configurationMap, configurationKeys, defaults) Map parameters, List parameterKeys,
merged.putAll(filterByKeyAndNull(parameters, parameterKeys)) Map configuration, List configurationKeys,
Map defaults=[:]
return merged ){
return merge(
parameters, MapUtils.fromList(parameterKeys),
configuration, MapUtils.fromList(configurationKeys),
defaults)
} }
@NonCPS @NonCPS