Java高新技术——内省(JavaBean)下面这篇文章写的不错,通俗易懂,建议先看下文章中的示例:https://blog.csdn.net/zhongkelee/article/details/52678667
下面是JDK javabean package 文档说明: https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/beans/package-summary.html
截取仅供快速参考。
Interface | Description |
---|---|
AppletInitializer | Deprecated.
The Applet API is deprecated.
|
BeanInfo |
Use the BeanInfo interface to create a BeanInfo class and provide explicit information about the methods, properties, events, and other features of your beans.
|
Customizer |
A customizer class provides a complete custom GUI for customizing a target Java Bean.
|
DesignMode |
This interface is intended to be implemented by, or delegated from, instances of java.beans.beancontext.BeanContext, in order to propagate to its nested hierarchy of java.beans.beancontext.BeanContextChild instances, the current "designTime" property.
|
ExceptionListener |
An ExceptionListener is notified of internal exceptions.
|
PropertyChangeListener |
A "PropertyChange" event gets fired whenever a bean changes a "bound" property.
|
PropertyEditor |
A PropertyEditor class provides support for GUIs that want to allow users to edit a property value of a given type.
|
VetoableChangeListener |
A VetoableChange event gets fired whenever a bean changes a "constrained" property.
|
Visibility |
Under some circumstances a bean may be run on servers where a GUI is not available.
|
Class | Description |
---|---|
BeanDescriptor |
A BeanDescriptor provides global information about a "bean", including its Java class, its displayName, etc.
|
Beans |
This class provides some general purpose beans control methods.
|
DefaultPersistenceDelegate |
The DefaultPersistenceDelegate is a concrete implementation of the abstract PersistenceDelegate class and is the delegate used by default for classes about which no information is available.
|
Encoder |
An Encoder is a class which can be used to create files or streams that encode the state of a collection of JavaBeans in terms of their public APIs.
|
EventHandler |
The EventHandler class provides support for dynamically generating event listeners whose methods execute a simple statement involving an incoming event object and a target object.
|
EventSetDescriptor |
An EventSetDescriptor describes a group of events that a given Java bean fires.
|
Expression |
An Expression object represents a primitive expression in which a single method is applied to a target and a set of arguments to return a result - as in "a.getFoo()".
|
FeatureDescriptor |
The FeatureDescriptor class is the common baseclass for PropertyDescriptor, EventSetDescriptor, and MethodDescriptor, etc.
|
IndexedPropertyChangeEvent |
An "IndexedPropertyChange" event gets delivered whenever a component that conforms to the JavaBeans™ specification (a "bean") changes a bound indexed property.
|
IndexedPropertyDescriptor |
An IndexedPropertyDescriptor describes a property that acts like an array and has an indexed read and/or indexed write method to access specific elements of the array.
|
Introspector |
The Introspector class provides a standard way for tools to learn about the properties, events, and methods supported by a target Java Bean.
|
MethodDescriptor |
A MethodDescriptor describes a particular method that a Java Bean supports for external access from other components.
|
ParameterDescriptor |
The ParameterDescriptor class allows bean implementors to provide additional information on each of their parameters, beyond the low level type information provided by the java.lang.reflect.Method class.
|
PersistenceDelegate |
The PersistenceDelegate class takes the responsibility for expressing the state of an instance of a given class in terms of the methods in the class's public API.
|
PropertyChangeEvent |
A "PropertyChange" event gets delivered whenever a bean changes a "bound" or "constrained" property.
|
PropertyChangeListenerProxy |
A class which extends the EventListenerProxy specifically for adding a PropertyChangeListener with a "bound" property.
|
PropertyChangeSupport |
This is a utility class that can be used by beans that support bound properties.
|
PropertyDescriptor |
A PropertyDescriptor describes one property that a Java Bean exports via a pair of accessor methods.
|
PropertyEditorManager |
The PropertyEditorManager can be used to locate a property editor for any given type name.
|
PropertyEditorSupport |
This is a support class to help build property editors.
|
SimpleBeanInfo |
This is a support class to make it easier for people to provide BeanInfo classes.
|
Statement |
A Statement object represents a primitive statement in which a single method is applied to a target and a set of arguments - as in "a.setFoo(b)".
|
VetoableChangeListenerProxy |
A class which extends the EventListenerProxy specifically for adding a VetoableChangeListener with a "constrained" property.
|
VetoableChangeSupport |
This is a utility class that can be used by beans that support constrained properties.
|
XMLDecoder |
The XMLDecoder class is used to read XML documents created using the XMLEncoder and is used just like the ObjectInputStream.
|
XMLEncoder |
The XMLEncoder class is a complementary alternative to the ObjectOutputStream and can used to generate a textual representation of a JavaBean in the same way that the ObjectOutputStream can be used to create binary representation of Serializable objects.
|
Exception | Description |
---|---|
IntrospectionException |
Thrown when an exception happens during Introspection.
|
PropertyVetoException |
A PropertyVetoException is thrown when a proposed change to a property represents an unacceptable value.
|
Annotation Type | Description |
---|---|
BeanProperty |
An annotation used to specify some property-related information for the automatically generated BeanInfo classes.
|
ConstructorProperties |
An annotation on a constructor that shows how the parameters of that constructor correspond to the constructed object's getter methods.
|
JavaBean |
An annotation used to specify some class-related information for the automatically generated BeanInfo classes.
|
Transient |
Indicates that an attribute called "transient" should be declared with the given value when the Introspector constructs a PropertyDescriptor or EventSetDescriptor classes associated with the annotated code element.
|
PropertyDescriptor(String propertyName, Class<?> beanClass) /////////////////////////// Introspector的静态方法: static String decapitalize(String name) Utility method to take a string and convert it to normal Java variable name capitalization. static void flushCaches() Flush all of the Introspector's internal caches. static void flushFromCaches(Class<?> clz) Flush the Introspector's internal cached information for a given class. static BeanInfo getBeanInfo(Class<?> beanClass) Introspect on a Java Bean and learn about all its properties, exposed methods, and events. static BeanInfo getBeanInfo(Class<?> beanClass, int flags) Introspect on a Java bean and learn about all its properties, exposed methods, and events, subject to some control flags. static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass) Introspect on a Java bean and learn all about its properties, exposed methods, below a given "stop" point. static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass, int flags) Introspect on a Java Bean and learn about all its properties, exposed methods and events, below a given stopClass point subject to some control flags. static String[] getBeanInfoSearchPath() Gets the list of package names that will be used for finding BeanInfo classes. static void setBeanInfoSearchPath(String[] path) Change the list of package names that will be used for finding BeanInfo classes.