[New] Added GroupedParameterizedElement.isRelationSet()

This commit is contained in:
Robert von Burg 2021-12-03 17:19:57 +01:00
parent 055a60bd78
commit 9de09a6fbf
2 changed files with 24 additions and 0 deletions

View File

@ -960,6 +960,17 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
return bag.hasParameter(paramKey);
}
@Override
public boolean isRelationSet(String paramKey) {
if (this.parameterBagMap == null)
return false;
ParameterBag bag = this.parameterBagMap.get(BAG_RELATIONS);
if (bag == null)
return false;
StringParameter relationP = bag.getStringP(paramKey);
return relationP != null && relationP.isSet();
}
@Override
public boolean hasParameter(String bagKey, String paramKey) {
if (this.parameterBagMap == null) {

View File

@ -1624,6 +1624,19 @@ public interface ParameterBagContainer extends StrolchElement {
*/
boolean hasRelation(String paramKey);
/**
* Returns true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the id
* {@link StrolchModelConstants#BAG_RELATIONS} and the value of the parameter is also set, i.e. not empty
*
* @param paramKey
* the key of the {@link Parameter} to be found
*
* @return true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the given
* bagKey and the value of the parameter is also set, i.e. not empty. False is returned if the {@link ParameterBag} does not exist, the {@link Parameter} does not exist on
* the {@link ParameterBag}, or the value of the parameter is empty
*/
boolean isRelationSet(String paramKey);
/**
* Returns true if the {@link Parameter} with the given paramKey exists on the {@link ParameterBag} with the given
* bagKey