Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.progeeks.meta.beans
Class BeanInspector  view BeanInspector download BeanInspector.java

java.lang.Object
  extended byorg.progeeks.meta.beans.BeanInspector

public class BeanInspector
extends java.lang.Object

Provides reflection utilities for a single bean class. This internally caches bean methods so that they don't have to be looked up repeatedly. In addition, it can provide additional info about the class that is important to know about things like multi-valued properties and such.

Note: This class functions different than the org.progeeks.util.Inspector class and may one day replace it. This class provides an object per class where as the Inspector class provides and object per object.

Version:
$Revision: 1.7 $

Field Summary
private  java.lang.Class beanClass
           
private  java.util.Map descriptors
           
private static java.util.Map inspectorCache
          A cache of previously created bean inspector objects keyed off of class.
(package private) static org.progeeks.util.log.Log log
           
 
Constructor Summary
protected BeanInspector(java.lang.Class beanClass)
           
 
Method Summary
 void addPropertyElement(java.lang.Object bean, java.lang.String property, int index, java.lang.Object value)
           
 boolean addPropertyElement(java.lang.Object bean, java.lang.String property, java.lang.Object value)
           
protected  void cacheDescriptors()
           
 java.lang.Class getBeanClass()
           
 ContainerPropertyDescriptor getContainerDescriptor(java.lang.String property)
           
 java.beans.PropertyDescriptor getDescriptor(java.lang.String property)
           
static BeanInspector getInspector(java.lang.Class c)
           
 java.util.List getListProperty(java.lang.Object bean, java.lang.String property)
           
 java.lang.Object getProperty(java.lang.Object bean, java.lang.String property)
           
 java.lang.Object getPropertyElement(java.lang.Object bean, java.lang.String property, int index)
           
 java.lang.Class getPropertyType(java.lang.String property)
           
 boolean isContainerProperty(java.lang.String property)
           
 boolean isListProperty(java.lang.String property)
           
static void releaseInspector(java.lang.Class c)
           
 java.lang.Object removePropertyElement(java.lang.Object bean, java.lang.String property, int index)
           
 boolean removePropertyElement(java.lang.Object bean, java.lang.String property, java.lang.Object value)
           
 void setProperty(java.lang.Object bean, java.lang.String property, java.lang.Object value)
           
 java.lang.Object setPropertyElement(java.lang.Object bean, java.lang.String property, int index, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.progeeks.util.log.Log log

inspectorCache

private static java.util.Map inspectorCache
A cache of previously created bean inspector objects keyed off of class. This is a potential resource leak depending on how high up in the class loader hierarchy this class is actually loaded. It could actually be an object in the meta-kit if it ever really mattered.


beanClass

private java.lang.Class beanClass

descriptors

private java.util.Map descriptors
Constructor Detail

BeanInspector

protected BeanInspector(java.lang.Class beanClass)
Method Detail

getInspector

public static BeanInspector getInspector(java.lang.Class c)

releaseInspector

public static void releaseInspector(java.lang.Class c)

cacheDescriptors

protected void cacheDescriptors()
                         throws java.beans.IntrospectionException

getBeanClass

public java.lang.Class getBeanClass()

setProperty

public void setProperty(java.lang.Object bean,
                        java.lang.String property,
                        java.lang.Object value)

getPropertyType

public java.lang.Class getPropertyType(java.lang.String property)

getProperty

public java.lang.Object getProperty(java.lang.Object bean,
                                    java.lang.String property)

isListProperty

public boolean isListProperty(java.lang.String property)

isContainerProperty

public boolean isContainerProperty(java.lang.String property)

getListProperty

public java.util.List getListProperty(java.lang.Object bean,
                                      java.lang.String property)

addPropertyElement

public boolean addPropertyElement(java.lang.Object bean,
                                  java.lang.String property,
                                  java.lang.Object value)

addPropertyElement

public void addPropertyElement(java.lang.Object bean,
                               java.lang.String property,
                               int index,
                               java.lang.Object value)

setPropertyElement

public java.lang.Object setPropertyElement(java.lang.Object bean,
                                           java.lang.String property,
                                           int index,
                                           java.lang.Object value)

removePropertyElement

public boolean removePropertyElement(java.lang.Object bean,
                                     java.lang.String property,
                                     java.lang.Object value)

removePropertyElement

public java.lang.Object removePropertyElement(java.lang.Object bean,
                                              java.lang.String property,
                                              int index)

getPropertyElement

public java.lang.Object getPropertyElement(java.lang.Object bean,
                                           java.lang.String property,
                                           int index)

getDescriptor

public java.beans.PropertyDescriptor getDescriptor(java.lang.String property)

getContainerDescriptor

public ContainerPropertyDescriptor getContainerDescriptor(java.lang.String property)