com.taggercat.util
Class ExpressionUtils

java.lang.Object
  extended by com.taggercat.util.ExpressionUtils

public class ExpressionUtils
extends java.lang.Object

A set of static utility functions used for expression evaluation.

 

Field Summary
static java.util.Map<java.lang.String,java.lang.Integer> namedScopes
           
 
Constructor Summary
ExpressionUtils()
           
 
Method Summary
static java.lang.Object executeMethod(java.lang.Object startingObject, java.lang.String methodName)
          Executes an action method on the entity.
static java.lang.Object executeMethod(java.lang.Object startingObject, java.lang.String methodName, java.lang.Object[] arguments, java.lang.Class<?>[] parameterTypes)
          Executes an action method on the entity.
static java.lang.Object getBeanProperty(java.lang.Object startingObject, java.lang.String scopedMethodName)
          Gets the bean property.
static java.lang.Object resolveTerm(java.lang.String term, Model model, javax.servlet.http.HttpServletRequest request)
          Resolves the term to a scoped variable, or a data source field.
static java.lang.Object resolveTerm(java.lang.String term, Model model, javax.servlet.http.HttpServletRequest request, javax.servlet.jsp.PageContext pageContext)
          Resolves the term to a scoped variable, or a datasource field.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namedScopes

public static java.util.Map<java.lang.String,java.lang.Integer> namedScopes
Constructor Detail

ExpressionUtils

public ExpressionUtils()
Method Detail

resolveTerm

public static java.lang.Object resolveTerm(java.lang.String term,
                                           Model model,
                                           javax.servlet.http.HttpServletRequest request)
                                    throws java.lang.IllegalArgumentException
Resolves the term to a scoped variable, or a data source field.

Throws:
java.lang.IllegalArgumentException
Parameters:
term - the dot delimited term to resolve
model - the current model object
request - the current request object
Returns:
the resolved term, or null if the term is not located

resolveTerm

public static java.lang.Object resolveTerm(java.lang.String term,
                                           Model model,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.jsp.PageContext pageContext)
                                    throws java.lang.IllegalArgumentException
Resolves the term to a scoped variable, or a datasource field.

Throws:
java.lang.IllegalArgumentException
Parameters:
term - the dot delimited term to resolve
model - the current model object
request - the current request object
pageContext - the current page context, this only applies to JSP tags
Returns:
the resolved term, or null if the term is not located

getBeanProperty

public static java.lang.Object getBeanProperty(java.lang.Object startingObject,
                                               java.lang.String scopedMethodName)
                                        throws java.lang.IllegalArgumentException
Gets the bean property.

Throws:
java.lang.IllegalArgumentException
Parameters:
startingObject - the source, or starting object to execute the method on
scopedMethodName - the method name of the form = "customer.order.account.foo";
Returns:
the property returned from the last getter, eg. getFoo()

executeMethod

public static java.lang.Object executeMethod(java.lang.Object startingObject,
                                             java.lang.String methodName)
                                      throws java.lang.Exception
Executes an action method on the entity. The action method is called in response to a constraint condition being evaluated to true, and an action method is specified. The action method must be a no-argument method.

Throws:
java.lang.Exception
Parameters:
startingObject -
methodName -
Returns:
the result of the method call

executeMethod

public static java.lang.Object executeMethod(java.lang.Object startingObject,
                                             java.lang.String methodName,
                                             java.lang.Object[] arguments,
                                             java.lang.Class<?>[] parameterTypes)
                                      throws java.lang.Exception
Executes an action method on the entity. The action method is called in response to a constraint condition being evaluated to true, and an action method is specified. The action method must be a no-argument method.

Throws:
java.lang.Exception
Parameters:
startingObject - the starting object
methodName - the dot delimited method name
arguments - the args
Returns:
the result of the method call