[New] Added getParametersByInterpretation()
This commit is contained in:
parent
96108a4c4e
commit
e128d42365
|
@ -140,6 +140,24 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all the {@link Parameter Parameters} with the given interpretation
|
||||||
|
*
|
||||||
|
* @param bagKey
|
||||||
|
* the key of the {@link ParameterBag} from which the {@link Parameter} is to be returned
|
||||||
|
* @param interpretation
|
||||||
|
* the interpretation for which the parameters are to be returned
|
||||||
|
*
|
||||||
|
* @return the parameters with the given interpretation
|
||||||
|
*/
|
||||||
|
public List<Parameter<?>> getParametersByInterpretation(String bagKey, String interpretation) {
|
||||||
|
ParameterBag bag = getParameterBag(bagKey);
|
||||||
|
if (bag == null)
|
||||||
|
return Collections.emptyList();
|
||||||
|
|
||||||
|
return bag.getParametersByInterpretation(interpretation);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new {@link Parameter} to the {@link ParameterBag} with the given key
|
* Adds a new {@link Parameter} to the {@link ParameterBag} with the given key
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import li.strolch.exception.StrolchException;
|
import li.strolch.exception.StrolchException;
|
||||||
import li.strolch.exception.StrolchModelException;
|
import li.strolch.exception.StrolchModelException;
|
||||||
|
@ -172,6 +173,23 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
||||||
return new ArrayList<>(this.parameterMap.values());
|
return new ArrayList<>(this.parameterMap.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all the {@link Parameter Parameters} with the given interpretation
|
||||||
|
*
|
||||||
|
* @param interpretation
|
||||||
|
* the interpretation for which the parameters are to be returned
|
||||||
|
*
|
||||||
|
* @return the parameters with the given interpretation
|
||||||
|
*/
|
||||||
|
public List<Parameter<?>> getParametersByInterpretation(String interpretation) {
|
||||||
|
if (this.parameterMap == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.parameterMap.values().stream().filter(p -> p.getInterpretation().equals(interpretation))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true, if the this {@link ParameterizedElement} has any {@link Parameter Parameters}, false otherwise
|
* Returns true, if the this {@link ParameterizedElement} has any {@link Parameter Parameters}, false otherwise
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue