org.richfaces.cdk.templatecompiler.el
Class ELParserUtils

java.lang.Object
  extended by org.richfaces.cdk.templatecompiler.el.ELParserUtils

public final class ELParserUtils
extends java.lang.Object

Class, that encapsulate all functionality, related to Reflection calls, such as loading classes, get property descriptors etc...

Author:
amarkhel

Method Summary
static void clearCaches()
           
static java.lang.String coerceToType(java.lang.String valueString, ELVisitor visitor, Type expectedType)
           
static ITreeNode determineNodeType(org.jboss.el.parser.Node child)
          This method determine type of parsed node and create wrapper for them, that extends AbstractTreeNode.
static Type getMatchingVisibleMethodReturnType(java.lang.Class<?> clazz, java.lang.String methodName, Type[] parameterTypes)
           Find an accessible method that matches the given name and has compatible parameters.
static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class<?> clazz, java.lang.String propertyName)
          This method return PropertyDescriptor by specified propertyName and clazz.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

determineNodeType

public static ITreeNode determineNodeType(org.jboss.el.parser.Node child)
                                   throws ParsingException
This method determine type of parsed node and create wrapper for them, that extends AbstractTreeNode. If node type is not recognized - throws ParsingException.

Parameters:
child - - parsed node
Returns:
wrapper for parsed node(if node type is recognized), that implement ITreeNode interface.
Throws:
ParsingException - - if node type is not recognized.

getPropertyDescriptor

public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class<?> clazz,
                                                                  java.lang.String propertyName)
                                                           throws ParsingException
This method return PropertyDescriptor by specified propertyName and clazz.

Parameters:
clazz - - class to search
propertyName - - propertyName to search
Returns:
property descriptor if found.
Throws:
ParsingException - if error occured.

getMatchingVisibleMethodReturnType

public static Type getMatchingVisibleMethodReturnType(java.lang.Class<?> clazz,
                                                      java.lang.String methodName,
                                                      Type[] parameterTypes)
                                               throws ParsingException

Find an accessible method that matches the given name and has compatible parameters. Compatible parameters mean that every method parameter is assignable from the given parameters. In other words, it finds a method with the given name that will take the parameters given.

This method is slightly undeterminstic since it loops through methods names and return the first matching method.

This method is used by #invokeMethod(Object object,String methodName,Object [] args,Class[] parameterTypes).

This method can match primitive parameter by passing in wrapper classes. For example, a Boolean will match a primitive boolean parameter.

Parameters:
clazz - find method in this class
methodName - find method with this name
parameterTypes - find method with compatible parameters
Returns:
The accessible method
Throws:
ParsingException - if error occured.

clearCaches

public static void clearCaches()

coerceToType

public static java.lang.String coerceToType(java.lang.String valueString,
                                            ELVisitor visitor,
                                            Type expectedType)


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.