org.omnifaces.el
Class ExpressionInspector

java.lang.Object
  extended by org.omnifaces.el.ExpressionInspector

public class ExpressionInspector
extends java.lang.Object

This class contains methods that inspect expressions to reveal information about them.

Since:
1.4
Author:
Arjan Tijms

Constructor Summary
ExpressionInspector()
           
 
Method Summary
static java.lang.reflect.Method findMethod(java.lang.Object base, java.lang.String methodName)
          Finds a method based on the method name only.
static MethodReference getMethodReference(javax.el.ELContext context, javax.el.ValueExpression valueExpression)
          Gets a MethodReference from a ValueExpression.
static javax.el.ValueReference getValueReference(javax.el.ELContext context, javax.el.ValueExpression valueExpression)
          Gets the ValueReference from a ValueExpression, without any checks whether the property is actually a property or if it isn't a "MethodSuffix".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionInspector

public ExpressionInspector()
Method Detail

getValueReference

public static javax.el.ValueReference getValueReference(javax.el.ELContext context,
                                                        javax.el.ValueExpression valueExpression)
Gets the ValueReference from a ValueExpression, without any checks whether the property is actually a property or if it isn't a "MethodSuffix". The property is stored as it appears in the expression, and may thus not actually exists. It's up to the caller how to interpret this.

This is also a workaround for the fact that a ValueReference can't be obtained from a TagValueExpression in JSF 2.x (since it doesn't implement getValueReference and its super class just returns null).

Parameters:
context - the context of this evaluation
valueExpression - the value expression being evaluated
Returns:
a ValueReference holding the final base and property where the value expression evaluated to.

getMethodReference

public static MethodReference getMethodReference(javax.el.ELContext context,
                                                 javax.el.ValueExpression valueExpression)
Gets a MethodReference from a ValueExpression. This assumes that this expression references a method.

Note that the method reference contains a method with the name the expression refers to. Overloads are not supported.

Parameters:
context - the context of this evaluation
valueExpression - the value expression being evaluated
Returns:
a MethodReference holding the final base and Method where the value expression evaluated to.

findMethod

public static java.lang.reflect.Method findMethod(java.lang.Object base,
                                                  java.lang.String methodName)
Finds a method based on the method name only. Does not support overloaded methods.

Parameters:
base - the object in which the method is to be found
methodName - name of the method to be found
Returns:
a method if one is found, null otherwise