[New] Added setString(String, Enum) to set String params from enums
This commit is contained in:
parent
23c95cebd0
commit
843f16244a
|
@ -275,6 +275,17 @@ public abstract class GroupedParameterizedElement extends AbstractStrolchElement
|
|||
defaultBag().setString(paramKey, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setString(String paramKey, Enum<?> value) throws StrolchModelException {
|
||||
defaultBag().setString(paramKey, value.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setString(String bagKey, String paramKey, Enum<?> value) throws StrolchModelException {
|
||||
ParameterBag bag = getParameterBag(bagKey, true);
|
||||
bag.setString(paramKey, value.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setString(String bagKey, String paramKey, String value) throws StrolchModelException {
|
||||
ParameterBag bag = getParameterBag(bagKey, true);
|
||||
|
|
|
@ -423,6 +423,20 @@ public interface ParameterBagContainer extends StrolchElement {
|
|||
*/
|
||||
void setString(String paramKey, String value) throws StrolchModelException;
|
||||
|
||||
/**
|
||||
* Sets the given enum's name value on the {@link StringParameter} with the given paramKey on the {@link
|
||||
* ParameterBag} with the ID {@link StrolchModelConstants#BAG_PARAMETERS}
|
||||
*
|
||||
* @param paramKey
|
||||
* the key of the parameter for which to return the value
|
||||
* @param value
|
||||
* the value to set on the parameter
|
||||
*
|
||||
* @throws StrolchModelException
|
||||
* if the parameter does not exist
|
||||
*/
|
||||
void setString(String paramKey, Enum<?> value) throws StrolchModelException;
|
||||
|
||||
/**
|
||||
* Sets the given value on the {@link StringParameter} with the given paramKey on the {@link ParameterBag} with the
|
||||
* given bagKey
|
||||
|
@ -439,6 +453,22 @@ public interface ParameterBagContainer extends StrolchElement {
|
|||
*/
|
||||
void setString(String bagKey, String paramKey, String value) throws StrolchModelException;
|
||||
|
||||
/**
|
||||
* Sets the given enum's name value on the {@link StringParameter} with the given paramKey on the {@link
|
||||
* ParameterBag} with the given bagKey
|
||||
*
|
||||
* @param bagKey
|
||||
* the key from which {@link ParameterBag} to get the parameter
|
||||
* @param paramKey
|
||||
* the key of the parameter for which to return the value
|
||||
* @param value
|
||||
* the value to set on the parameter
|
||||
*
|
||||
* @throws StrolchModelException
|
||||
* if the parameter does not exist
|
||||
*/
|
||||
void setString(String bagKey, String paramKey, Enum<?> value) throws StrolchModelException;
|
||||
|
||||
/**
|
||||
* Sets the given value on the {@link BooleanParameter} with the given paramKey on the {@link ParameterBag} with the
|
||||
* ID {@link StrolchModelConstants#BAG_PARAMETERS}
|
||||
|
|
|
@ -344,6 +344,25 @@ public abstract class ParameterizedElement extends AbstractStrolchElement {
|
|||
param.setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given enum's name value on the {@link StringParameter} with the given paramKey
|
||||
*
|
||||
* @param paramKey
|
||||
* the key of the parameter for which to return the value
|
||||
* @param value
|
||||
* the value to set on the parameter
|
||||
*
|
||||
* @throws StrolchModelException
|
||||
* if the parameter does not exist
|
||||
*/
|
||||
public void setString(String paramKey, Enum<?> value) throws StrolchModelException {
|
||||
StringParameter param = getParameter(paramKey, false);
|
||||
if (param == null)
|
||||
addParameter(new StringParameter(paramKey, paramKey, value));
|
||||
else
|
||||
param.setValue(value.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the given value on the {@link BooleanParameter} with the given paramKey
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue