|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.beans.BeanInspector
public class BeanInspector
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.
Constructor Summary | |
---|---|
protected |
BeanInspector(java.lang.Class beanClass)
|
Method Summary | |
---|---|
boolean |
addPropertyChangeListener(java.lang.Object bean,
java.beans.PropertyChangeListener listener)
Uses reflection to add the listener to the specified bean if it has the appropriate add property change listener method. |
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.util.Set |
getPropertyNames()
Returns a read-only view of the set of property names. |
java.lang.Class |
getPropertyType(java.lang.String property)
|
boolean |
isContainerProperty(java.lang.String property)
|
boolean |
isListProperty(java.lang.String property)
|
boolean |
isMutableProperty(java.lang.String property)
Returns true if the specified property exists and is either a writeable property or a collection that can be modified. |
boolean |
isReadableProperty(java.lang.String property)
Returns true if the specified property exists and has an accessor method. |
boolean |
isWriteableProperty(java.lang.String property)
Returns true if the specified property exists and has a mutator method. |
static void |
main(java.lang.String[] args)
|
static void |
releaseInspector(java.lang.Class c)
|
void |
removePropertyChangeListener(java.lang.Object bean,
java.beans.PropertyChangeListener listener)
Removes a previously added listener from the specified bean. |
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)
|
protected static java.lang.reflect.AccessibleObject |
verifyAccess(java.lang.reflect.AccessibleObject obj)
Work-around a sort of anomoly in the reflection classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BeanInspector(java.lang.Class beanClass)
Method Detail |
---|
public static BeanInspector getInspector(java.lang.Class c)
public static void releaseInspector(java.lang.Class c)
protected void cacheDescriptors() throws java.beans.IntrospectionException
java.beans.IntrospectionException
protected static java.lang.reflect.AccessibleObject verifyAccess(java.lang.reflect.AccessibleObject obj)
public java.lang.Class getBeanClass()
public boolean isWriteableProperty(java.lang.String property)
public boolean isMutableProperty(java.lang.String property)
public boolean isReadableProperty(java.lang.String property)
public void setProperty(java.lang.Object bean, java.lang.String property, java.lang.Object value)
public java.lang.Class getPropertyType(java.lang.String property)
public java.lang.Object getProperty(java.lang.Object bean, java.lang.String property)
public boolean isListProperty(java.lang.String property)
public boolean isContainerProperty(java.lang.String property)
public java.util.List getListProperty(java.lang.Object bean, java.lang.String property)
public boolean addPropertyElement(java.lang.Object bean, java.lang.String property, java.lang.Object value)
public void addPropertyElement(java.lang.Object bean, java.lang.String property, int index, java.lang.Object value)
public java.lang.Object setPropertyElement(java.lang.Object bean, java.lang.String property, int index, java.lang.Object value)
public boolean removePropertyElement(java.lang.Object bean, java.lang.String property, java.lang.Object value)
public java.lang.Object removePropertyElement(java.lang.Object bean, java.lang.String property, int index)
public java.lang.Object getPropertyElement(java.lang.Object bean, java.lang.String property, int index)
public java.util.Set getPropertyNames()
public java.beans.PropertyDescriptor getDescriptor(java.lang.String property)
public ContainerPropertyDescriptor getContainerDescriptor(java.lang.String property)
public boolean addPropertyChangeListener(java.lang.Object bean, java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.Object bean, java.beans.PropertyChangeListener listener)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |