org.jete.model
Class ResultWrapperUtils
java.lang.Object
org.jete.model.ResultWrapperUtils
- public class ResultWrapperUtils
- extends java.lang.Object
Simplify and concentrate the wrapper interface for use by result validators and actions. Actions and
validators using the ResultWrapper should use this utility object to wrap or extract values from
the results.
- Version:
- $Id: ResultWrapperUtils.html,v 1.3 2006/03/12 02:46:59 tdeast Exp $
Method Summary |
static java.lang.Object |
getProperty(org.springframework.beans.BeanWrapper wrapper,
org.springframework.beans.PropertyValue propertyValue)
Retrieve the propertyValue from the bean wrapper given the specified rules. |
static java.lang.Object |
wrapIfNecessary(java.lang.Object invocationResult)
Determine if, based on the rules, this invocation result should be wrapped into a ResultWrapper. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResultWrapperUtils
public ResultWrapperUtils()
wrapIfNecessary
public static java.lang.Object wrapIfNecessary(java.lang.Object invocationResult)
- Determine if, based on the rules, this invocation result should be wrapped into a ResultWrapper.
The rules concerning wrapping are:
- The result is primitive (Integer, Float, etc.)
- The result is an object array
- The result is a collection
- Otherwise, the submitted result object
If the result is a collection, the collection is simplified by calling toArray, for easier validation
- Parameters:
invocationResult
-
- Returns:
- Wrapped result object if primitive or collection
getProperty
public static java.lang.Object getProperty(org.springframework.beans.BeanWrapper wrapper,
org.springframework.beans.PropertyValue propertyValue)
- Retrieve the propertyValue from the bean wrapper given the specified rules. The rules are:
- if the wrapper is a ResultWrapper, and no property name is specified, use the default property name "value"
- if the property name is specified, use it
- otherwise, no property name is used (this should fail)
- Parameters:
wrapper
- propertyValue
-
- Returns:
- Retrieved result property