org.apache.myfaces.trinidadinternal.ui.data.bean
Class BeanAdapterUtils

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.ui.data.bean.BeanAdapterUtils

public class BeanAdapterUtils
extends java.lang.Object

Utilities for working with bean DataObject adapters. Provides a location to register adapter classes, which allow for a higher-performance implementation than ordinary introspection. However, developers should generally delay creating and registering an adapter class until performance metrics justify the addition.

By default, the Bean adapter classes will use the actual class of an object instance - that is, object.getClass() - to find an adapter, or use introspection to create an adapter. However, this is not always desirable for two reasons:

  1. For efficiency reasons, it's faster to reuse the same adapter class for all implementations of a single interface.
  2. Introspection cannot succeed on package-private classes. However, it works fine if that package-private class has a public superclass or implements a public interface - and that public class or interface supports those properties.

Adapters can be built using the BuildBeanDOAdapter tool, and all of this rigamarole can be entirely bypassed by handing to Cabo instances of these adapter classes instead of the bean classes themselves.

Version:
$Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/ui/data/bean/BeanAdapterUtils.java#0 $) $Date: 10-nov-2005.18:56:48 $
Author:
The Oracle ADF Faces Team
See Also:
org.apache.myfaces.trinidadinternal.ui.tools.BuildBeanDOAdapter

Constructor Summary
BeanAdapterUtils()
           
 
Method Summary
static DataObject getAdapter(java.lang.Object instance)
          Creates a DataObject adapter class around an object instance.
static DataObject getAdapter(java.lang.Object instance, java.lang.Class<?> objClass)
          Creates a DataObject adapter class around an object instance.
static DataObject getAdapter(UIXRenderingContext context, java.lang.Object instance)
          Creates a DataObject adapter class around an object instance.
static DataObjectList getAdapterList(UIXRenderingContext context, java.lang.Object listInstance)
          Creates a DataObjectList adapter class around an object.
static void registerAdapterClass(java.lang.Class<?> beanClass, java.lang.Class<?> adapterClass)
          Registers an adapter class to be used in place of introspection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanAdapterUtils

public BeanAdapterUtils()
Method Detail

getAdapter

public static DataObject getAdapter(java.lang.Object instance,
                                    java.lang.Class<?> objClass)
                             throws java.lang.IllegalAccessException,
                                    java.lang.InstantiationException
Creates a DataObject adapter class around an object instance. Instead of using the actual class of the instance, use a superclass. See above for reasons why this may be useful.

Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException

getAdapter

public static DataObject getAdapter(java.lang.Object instance)
                             throws java.lang.IllegalAccessException,
                                    java.lang.InstantiationException
Creates a DataObject adapter class around an object instance.

Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException

getAdapter

public static DataObject getAdapter(UIXRenderingContext context,
                                    java.lang.Object instance)
Creates a DataObject adapter class around an object instance. Instead of throwing exceptions, log exceptions with the RenderingContext's error log.


getAdapterList

public static DataObjectList getAdapterList(UIXRenderingContext context,
                                            java.lang.Object listInstance)
Creates a DataObjectList adapter class around an object.


registerAdapterClass

public static void registerAdapterClass(java.lang.Class<?> beanClass,
                                        java.lang.Class<?> adapterClass)
Registers an adapter class to be used in place of introspection.



Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.