org.displaytag.util
Class LookupUtil

java.lang.Object
  extended byorg.displaytag.util.LookupUtil

public final class LookupUtil
extends java.lang.Object

Utility class with methods for object and properties retrieving.

Version:
$Revision: 1.13 $ ($Author: fgiust $)
Author:
Fabrizio Giustina

Method Summary
static java.lang.Object getBeanProperty(java.lang.Object bean, java.lang.String name)
           Returns the value of a property in the given bean.
static java.lang.Object getBeanValue(javax.servlet.jsp.PageContext pageContext, java.lang.String beanAndPropertyName, int scope)
          Read an object from the pagecontext with the specified scope and eventually lookup a property in it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBeanValue

public static java.lang.Object getBeanValue(javax.servlet.jsp.PageContext pageContext,
                                            java.lang.String beanAndPropertyName,
                                            int scope)
                                     throws ObjectLookupException
Read an object from the pagecontext with the specified scope and eventually lookup a property in it.

Parameters:
pageContext - PageContext
beanAndPropertyName - String expression with bean name and attributes
scope - One of the following values:
  • PageContext.PAGE_SCOPE
  • PageContext.REQUEST_SCOPE
  • PageContext.SESSION_SCOPE
  • PageContext.APPLICATION_SCOPE
Returns:
Object
Throws:
ObjectLookupException - for errors while retrieving a property in the bean

getBeanProperty

public static java.lang.Object getBeanProperty(java.lang.Object bean,
                                               java.lang.String name)
                                        throws ObjectLookupException

Returns the value of a property in the given bean.

This method is a modificated version from commons-beanutils PropertyUtils.getProperty(). It allows intermediate nulls in expression without throwing exception (es. it doesn't throw an exception for the property object.date.time if date is null)

Parameters:
bean - javabean
name - name of the property to read from the javabean
Returns:
Object
Throws:
ObjectLookupException - for errors while retrieving a property in the bean


Copyright © 2002-2005 the Displaytag team. All Rights Reserved.