[New] Added ParameterizedElement.streamStringList()

This commit is contained in:
Robert von Burg 2021-01-20 18:21:05 +01:00
parent fac7d659d9
commit 648a47890c
2 changed files with 33 additions and 0 deletions

View File

@ -1238,6 +1238,21 @@ public interface ParameterBagContainer extends StrolchElement {
*/
List<String> getRelationIds(String paramKey) throws StrolchModelException;
/**
* Returns a stream over the values of the {@link StringListParameter} with the given key from the {@link
* ParameterBag} with the ID {@link StrolchModelConstants#BAG_RELATIONS}, if the {@link Parameter} or the {@link
* ParameterBag} does not exist, then a {@link StrolchModelException} is thrown
*
* @param paramKey
* the key of the {@link StringParameter} for which the value is to be returned
*
* @return a stream over the the parameter's values
*
* @throws StrolchModelException
* if the parameter does not exist
*/
Stream<String> streamRelationIds(String paramKey) throws StrolchModelException;
/**
* Sets the value of the {@link StringParameter} with the given key on the {@link ParameterBag} with the ID {@link
* StrolchModelConstants#BAG_RELATIONS}, if the {@link Parameter} or the {@link ParameterBag} does not exist, then a

View File

@ -271,6 +271,24 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
return param.getValue();
}
/**
* Returns a {@link Stream} over the elements of the {@link StringListParameter} with the given paramKey
*
* @param paramKey
* the key of the parameter for which to return the value
*
* @return a stream over the values of the parameter with the given paramKey
*
* @throws StrolchModelException
* if the parameter does not exist
*/
public Stream<String> streamStringList(String paramKey) throws StrolchModelException {
StringListParameter param = getParameter(paramKey, false);
if (param == null)
return Stream.empty();
return param.streamValues();
}
/**
* Returns the value of the {@link IntegerListParameter} with the given paramKey
*