org.openfaces.util
Class Faces

java.lang.Object
  extended by org.openfaces.util.Faces

public class Faces
extends java.lang.Object

Class intended to retrieve various parameters from request.


Method Summary
static java.lang.String requestParam(java.lang.String requestParameterMapKey)
          Retrieves a value from the request parameters map.
static
<T> T
requestParam(java.lang.String paramName, java.lang.Class<T> expectedType)
          Retrieves a value from the request parameters map and converts it to the specified type.
static java.lang.Object var(java.lang.String varName)
          Returns the value of the specified variable in the current expression context.
static
<T> T
var(java.lang.String varName, java.lang.Class<T> expectedType)
          Returns the value of the specified variable in the current expression context and casts it to the specified class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

var

public static <T> T var(java.lang.String varName,
                        java.lang.Class<T> expectedType)
             throws java.lang.ClassCastException
Returns the value of the specified variable in the current expression context and casts it to the specified class. This method returns the same value as would be returned by the #{varName} expression and is an easy way to get variable value in a backing bean if you can't write the value expression on your page directly and need to implement a more complex logic in the backing bean.

Parameters:
varName - variable name
expectedType - expected variable type
Returns:
variable value
Throws:
java.lang.ClassCastException - if the variable value is not of the expected type

var

public static java.lang.Object var(java.lang.String varName)
Returns the value of the specified variable in the current expression context. This method returns the same value as would be returned by the #{varName} expression and is an easy way to get variable value in a backing bean if you can't write the value expression on your page directly and need to implement a more complex logic in the backing bean.

Parameters:
varName - variable name
Returns:
variable value
Throws:
java.lang.ClassCastException - if the variable value is not of the expected type

requestParam

public static <T> T requestParam(java.lang.String paramName,
                                 java.lang.Class<T> expectedType)
Retrieves a value from the request parameters map and converts it to the specified type.

Parameters:
paramName - - request parameter name
expectedType - - expected parameter type
Returns:
corresponding value from request parameters map
See Also:
More about request parameters map

requestParam

public static java.lang.String requestParam(java.lang.String requestParameterMapKey)
Retrieves a value from the request parameters map.

Parameters:
requestParameterMapKey - - key
Returns:
corresponding value from request parameters map
See Also:
More about request parameters map


Copyright © 1998-2010 TeamDev Ltd. All Rights Reserved.