[New] Added ParameterBagContainer.getParameter() using StrolchModelConstants.BAG_PARAMETERS
This commit is contained in:
parent
07e7752c68
commit
6f7269c4ae
|
@ -16,6 +16,7 @@
|
||||||
package li.strolch.model;
|
package li.strolch.model;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toList;
|
import static java.util.stream.Collectors.toList;
|
||||||
|
import static li.strolch.model.StrolchModelConstants.BAG_PARAMETERS;
|
||||||
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
|
import static li.strolch.model.StrolchModelConstants.BAG_RELATIONS;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
@ -144,18 +145,98 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_PARAMETERS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public <U, T extends Parameter<U>> T getParameter(String paramKey) {
|
||||||
|
return getParameter(BAG_PARAMETERS, paramKey, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_PARAMETERS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
* @param assertExists
|
||||||
|
* if set to true, and the parameter does not exist, a {@link StrolchModelException} is thrown
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public <U, T extends Parameter<U>> T getParameter(String paramKey, boolean assertExists) {
|
||||||
|
return getParameter(BAG_PARAMETERS, paramKey, assertExists);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public StringParameter getRelationParam(String paramKey) {
|
public StringParameter getRelationParam(String paramKey) {
|
||||||
return getParameter(BAG_RELATIONS, paramKey, false);
|
return getParameter(BAG_RELATIONS, paramKey, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
* @param assertExists
|
||||||
|
* if set to true, and the parameter does not exist, a {@link StrolchModelException} is thrown
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public StringParameter getRelationParam(String paramKey, boolean assertExists) {
|
public StringParameter getRelationParam(String paramKey, boolean assertExists) {
|
||||||
return getParameter(BAG_RELATIONS, paramKey, assertExists);
|
return getParameter(BAG_RELATIONS, paramKey, assertExists);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringListParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public StringListParameter getRelationsParam(String paramKey) {
|
public StringListParameter getRelationsParam(String paramKey) {
|
||||||
return getParameter(BAG_RELATIONS, paramKey, false);
|
return getParameter(BAG_RELATIONS, paramKey, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringListParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
* @param assertExists
|
||||||
|
* if set to true, and the parameter does not exist, a {@link StrolchModelException} is thrown
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public StringListParameter getRelationsParam(String paramKey, boolean assertExists) {
|
public StringListParameter getRelationsParam(String paramKey, boolean assertExists) {
|
||||||
return getParameter(BAG_RELATIONS, paramKey, assertExists);
|
return getParameter(BAG_RELATIONS, paramKey, assertExists);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import java.util.stream.Stream;
|
||||||
import li.strolch.exception.StrolchException;
|
import li.strolch.exception.StrolchException;
|
||||||
import li.strolch.exception.StrolchModelException;
|
import li.strolch.exception.StrolchModelException;
|
||||||
import li.strolch.model.parameter.Parameter;
|
import li.strolch.model.parameter.Parameter;
|
||||||
|
import li.strolch.model.parameter.StringListParameter;
|
||||||
|
import li.strolch.model.parameter.StringParameter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link ParameterBagContainer} has a map of {@link ParameterBag ParameterBags} where the key is the id of the
|
* A {@link ParameterBagContainer} has a map of {@link ParameterBag ParameterBags} where the key is the id of the
|
||||||
|
@ -16,6 +18,84 @@ import li.strolch.model.parameter.Parameter;
|
||||||
*/
|
*/
|
||||||
public interface ParameterBagContainer extends StrolchElement {
|
public interface ParameterBagContainer extends StrolchElement {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the ID {@link *
|
||||||
|
* StrolchModelConstants#BAG_PARAMETERS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
<U, T extends Parameter<U>> T getParameter(String paramKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_PARAMETERS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
* @param assertExists
|
||||||
|
* if set to true, and the parameter does not exist, a {@link StrolchModelException} is thrown
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
<U, T extends Parameter<U>> T getParameter(String paramKey, boolean assertExists);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
StringParameter getRelationParam(String paramKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
* @param assertExists
|
||||||
|
* if set to true, and the parameter does not exist, a {@link StrolchModelException} is thrown
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
StringParameter getRelationParam(String paramKey, boolean assertExists);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringListParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
StringListParameter getRelationsParam(String paramKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link StringListParameter} with the given key from the {@link ParameterBag} with the ID {@link
|
||||||
|
* StrolchModelConstants#BAG_RELATIONS}, or null if the {@link Parameter} or the {@link ParameterBag} does not
|
||||||
|
* exist
|
||||||
|
*
|
||||||
|
* @param paramKey
|
||||||
|
* the key of the {@link Parameter} which is to be returned
|
||||||
|
* @param assertExists
|
||||||
|
* if set to true, and the parameter does not exist, a {@link StrolchModelException} is thrown
|
||||||
|
*
|
||||||
|
* @return the found {@link Parameter} or null if it was not found
|
||||||
|
*/
|
||||||
|
StringListParameter getRelationsParam(String paramKey, boolean assertExists);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the given bagKey, or null if
|
* Returns the {@link Parameter} with the given key from the {@link ParameterBag} with the given bagKey, or null if
|
||||||
* the {@link Parameter} or the {@link ParameterBag} does not exist
|
* the {@link Parameter} or the {@link ParameterBag} does not exist
|
||||||
|
|
Loading…
Reference in New Issue