|
OpMath | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
The interface required by objects making use of the parameter ((name / value) => index) functions.
An object that implements the ParamIndex interface provides utilities for managing and
accessing parameters passed to servlets using GET and POST methods. In particular, it allows the
servlet to establish any number of parameter name - parameter value list associations.
One of the chief advantages of ParamIndex is its ability to support the use of Java
switch statements over parameter values. In order for this to work, the index which is
associated with each parameter value must be declared as a static final int.
The design of ParamIndex is suited to implementation using a java.util.Hashtable
or a subclass of Hashtable.
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
| Method Summary | |
int |
getIndex(String paramName,
String paramValue)
Returns the int index associated with the pair paramName / paramValue,
as established by registerIndex(String, String, int). |
int |
getParamIndex(String paramName,
HttpServletRequest req)
Returns the int index of the parameter value found in the HttpServletRequest
whose name is paramName and whose value is found in the HttpServletRequest. |
int |
getValueCount(String paramName)
Returns the number of parameter values registered against the parameter name paramName. |
Enumeration |
paramIndices(String paramName)
Returns an Enumeration of the parameter indices for the values registered
against paramName. |
Enumeration |
paramMappings()
Returns an Enumeration of the parameter (value => index) mappings known to the registry. |
Enumeration |
paramNames()
Returns an Enumeration of the parameter names known to the registry. |
Enumeration |
paramValues(String paramName)
Returns an Enumeration of the parameter values registered against paramName. |
void |
registerIndex(String paramName,
String paramValue,
int paramValueIndex)
Associates the value of a servlet parameter with an int index. |
| Method Detail |
public void registerIndex(String paramName,
String paramValue,
int paramValueIndex)
int index.
The main use of the register is to enable switch statements to work over commands handed
to the servlet; to do this, the int must be declared as static final.
NOTE: Command parameter value strings should always be case-insensitive.
paramName - the String name of the parameter.paramValue - the String value of the parameter.paramValueIndex - the int value associated with the parameter value.
public int getIndex(String paramName,
String paramValue)
int index associated with the pair paramName / paramValue,
as established by registerIndex(String, String, int).
It is expected that, if the pair paramName / paramValue is not known to the registry,
then getIndex(String, String) will return the int value
com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.
NOTE: Command parameter value strings should always be case-insensitive.
paramName - the String name of the parameter.paramValue - the String value of the parameter.
int value of the parameter, or the int value
com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.
public int getParamIndex(String paramName,
HttpServletRequest req)
int index of the parameter value found in the HttpServletRequest
whose name is paramName and whose value is found in the HttpServletRequest.
It is expected that, if paramName is not found in the HttpServletRequest,
or if the value for paramName found in the HttpServletRequest is not known
to the registry, then getParamIndex(String, HttpServletRequest) will return the
int value com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.
NOTE: Command parameter value strings should always be case-insensitive.
paramName - the String name of the parameter.req - the HttpServletRequest containing the parameter.
int value of the parameter, or the int value
com.opmath.util.http.ParamIndex.PARAM_INDEX_FAIL.public int getValueCount(String paramName)
paramName.
It is expected that, if paramName is not known to the registry, then
getValueCount(String) will return the int value 0.
paramName - the String name of the parameter.
int total number of values held against this name.public Enumeration paramNames()
Enumeration of the parameter names known to the registry.
Enumeration of parameter names.public Enumeration paramMappings()
Enumeration of the parameter (value => index) mappings known to the registry.
Enumeration of parameter (value => index) mappings.public Enumeration paramValues(String paramName)
Enumeration of the parameter values registered against paramName.
It is expected that, if paramName is not known to the registry, then
paramValues() will return null.
paramName - the String name of the parameter.
Enumeration of parameter values.public Enumeration paramIndices(String paramName)
Enumeration of the parameter indices for the values registered
against paramName.
It is expected that, if paramName is not known to the registry, then
paramIndices() will return null.
paramName - the String name of the parameter.
Enumeration of parameter names.
|
OpMath | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||