palio.mvc
Class RequestParamUtils

java.lang.Object
  extended by palio.mvc.RequestParamUtils

public class RequestParamUtils
extends java.lang.Object


Constructor Summary
RequestParamUtils()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.Object> getParamsWithPrefix(java.lang.String prefix)
          Returns request parameters as a map.
static
<T> T
getParamValue(java.lang.Class<T> paramClass, java.lang.String paramName, java.lang.String format)
          Returns value of parameter with given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestParamUtils

public RequestParamUtils()
Method Detail

getParamValue

public static <T> T getParamValue(java.lang.Class<T> paramClass,
                                  java.lang.String paramName,
                                  java.lang.String format)
Returns value of parameter with given name. Supported types: String, Date, Long, Boolean, byte[], Object, Object[], Enum.

Type Parameters:
T - Requested type
Parameters:
paramClass - Requested type class
paramName - Param name
format - Format witch is used to convert String to required type (Date)
Returns:
Value for given parameter name or null if value is not set
Throws:
java.lang.IllegalArgumentException - If given param type is not supported

getParamsWithPrefix

public static java.util.Map<java.lang.String,java.lang.Object> getParamsWithPrefix(java.lang.String prefix)
                                                                            throws palio.PalioException
Returns request parameters as a map. If a prefix is passed, only parameters with this prefix will be put in a result map. A key for this parameters is a parameter name with prefix and "." cut. For example for "bean" prefix a key for "bean.someField" parameter is "someField".

Parameters:
prefix - Prefix that parameter name should start with to be placed in a result map
Throws:
palio.PalioException - If any exception occures while retriving parameters values