17.4.5. The IParameterMap Interface

The IParametersMap interface represent a collection of name-value pairs. The name is a string and the value is of type IValue. These source code parameters are usually defined in square brackets like this:

[name="Kevin", age=27, hacker=true]

The main methods defined on parameter maps are exists(), getValue(), getSourceRange() and getParameterNames(). In addition there are some convenience methods for easy retrieval of values of specific types:

Table 17.4. IParameterMap Interface

Method Description
boolean exist(String paramName) Tells if a parameter of the given name exists.
boolean getBoolValue(String paramName, boolean defaultValue) Returns the boolean parameter of the given name. The default is returned in case of an undefined value.
<T extends Enum<?>> T getEnumValue(Class<T> enumeration, String name, T defaultLitteral) Returns the enum parameter of the given name. The default is returned in case of an undefined value.
int getIntValue(String paramName, int defaultValue) Returns the int parameter of the given name. The default is returned in case of an undefined value.
Collection<String> getParameterNames() Returns the names of the defined parameters.
ISourceRange getSourceRange(String paramName) Returns the position at which this parameter is defined in the source code.
String getStringValue(String paramName, String defaultValue) Returns the string parameter of the given name. The default is returned in case of an undefined value.
IValue getValue(String paramName) Returns the value of the parameter with the given name.