public class BeanInfoFactory
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CATEGORY_KEY
Well known key for a property descriptor that holds the name of the category of the property.
|
static java.lang.String |
DISPLAY_ORDER_KEY
Well known key for a property descriptor that should be an integer that represents the relative display order
|
Constructor and Description |
---|
BeanInfoFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
addBeanInfoSearchPackage(java.lang.String pkg) |
static java.lang.Object |
executeMethod(java.lang.String methodName,
java.lang.Object source)
Helper method which uses reflection to search for the methodName on the target with no arguments.
|
static java.lang.Object |
executeMethod(java.lang.String methodName,
java.lang.Object source,
java.lang.Object arg)
Helper method which uses reflection to search for the methodName on the target with a single arg type as a
parameter.
|
static java.lang.Object |
executeMethod(java.lang.String methodName,
java.lang.Object source,
java.lang.Object arg,
java.lang.Class argType)
Helper method which uses reflection to execute a method with a single argument.
|
static java.lang.Object |
getBeanAttribute(java.lang.Class type,
java.lang.String attribute) |
static java.beans.BeanInfo |
getBeanInfo(java.lang.Class cls)
Retrieves the BeanInfo for a Class
|
static java.beans.BeanInfo |
getBeanInfo(java.lang.Class cls,
int flags) |
static java.awt.Container |
getContainerDelegate(java.lang.Object obj)
Returns the container delegate for the object.
|
static javax.swing.Icon |
getIcon(java.lang.Class cls)
Retrieves the BeanInfo icon for the class.
|
static java.beans.PropertyDescriptor |
getPropertyDescriptor(java.lang.Class type,
java.lang.String propertyName) |
static java.awt.Component |
getProxyComponent(java.lang.Object obj)
Returns the visual proxy for the object A visual proxy is a visual component which represents a non visual
component.
|
static boolean |
isContainer(java.lang.Object obj)
Determines if the object is a Swing container like JScrollPane
|
static void |
setBeanAttribute(java.lang.Class type,
java.lang.String attribute,
java.lang.Object value) |
static void |
setPropertyAttribute(java.lang.Class type,
java.lang.String property,
java.lang.String attribute,
java.lang.Object value) |
public static final java.lang.String DISPLAY_ORDER_KEY
public static final java.lang.String CATEGORY_KEY
public static void addBeanInfoSearchPackage(java.lang.String pkg)
public static java.lang.Object executeMethod(java.lang.String methodName, java.lang.Object source)
public static java.lang.Object executeMethod(java.lang.String methodName, java.lang.Object source, java.lang.Object arg)
For example, we wish to exectute Container.add(Component). The source object would be a Container instance, the argument would be an instance of a Component and the method name would be "add". If a JButton is used the component, the hierarchy will be walked: JButton -> JComponent -> Container -> Component until the add method on Container is found.
methodName
- name of the method to executesource
- object in which to invoke the methodarg
- object which is the argumentpublic static java.lang.Object executeMethod(java.lang.String methodName, java.lang.Object source, java.lang.Object arg, java.lang.Class argType)
methodName
- name of the method to executesource
- object in which to invoke the methodarg
- object which is the argumentargType
- type of the argument object.public static java.beans.BeanInfo getBeanInfo(java.lang.Class cls)
public static java.beans.BeanInfo getBeanInfo(java.lang.Class cls, int flags)
public static void setBeanAttribute(java.lang.Class type, java.lang.String attribute, java.lang.Object value)
public static java.lang.Object getBeanAttribute(java.lang.Class type, java.lang.String attribute)
public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class type, java.lang.String propertyName)
public static void setPropertyAttribute(java.lang.Class type, java.lang.String property, java.lang.String attribute, java.lang.Object value)
public static javax.swing.Icon getIcon(java.lang.Class cls)
public static boolean isContainer(java.lang.Object obj)
obj
- Object to test.public static java.awt.Container getContainerDelegate(java.lang.Object obj)
public static java.awt.Component getProxyComponent(java.lang.Object obj)