From 2f6b7e7b056c337c2bcaab1994d10c65c283be2d Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Wed, 25 Sep 2019 11:14:08 +0200 Subject: [PATCH] [New] Added ParameterizedElement.toObjectMap() --- .../li/strolch/model/ParameterizedElement.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/li.strolch.model/src/main/java/li/strolch/model/ParameterizedElement.java b/li.strolch.model/src/main/java/li/strolch/model/ParameterizedElement.java index 841523d14..de017142e 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/ParameterizedElement.java +++ b/li.strolch.model/src/main/java/li/strolch/model/ParameterizedElement.java @@ -16,9 +16,11 @@ package li.strolch.model; import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; import java.text.MessageFormat; import java.util.*; +import java.util.function.Function; import java.util.stream.Stream; import li.strolch.exception.StrolchException; @@ -275,6 +277,18 @@ public abstract class ParameterizedElement extends AbstractStrolchElement { return new HashSet<>(this.parameterMap.keySet()); } + /** + * Returns a simple map where the keys are the IDs of the parameters and the values are the values of the + * Parameters + * + * @return a simple map where the keys are the IDs of the parameters and the values are the values of the * + * Parameters + */ + public Map toObjectMap() { + return this.parameterMap.values().stream() + .collect(toMap(StrolchElement::getId, (Function, Object>) Parameter::getValue)); + } + @Override public abstract void fillLocator(LocatorBuilder lb);