[New] Added ParameterizedElement.toObjectMap()

This commit is contained in:
Robert von Burg 2019-09-25 11:14:08 +02:00
parent aec29adcd1
commit 2f6b7e7b05
1 changed files with 14 additions and 0 deletions

View File

@ -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<String, Object> toObjectMap() {
return this.parameterMap.values().stream()
.collect(toMap(StrolchElement::getId, (Function<Parameter<?>, Object>) Parameter::getValue));
}
@Override
public abstract void fillLocator(LocatorBuilder lb);