Interface BeanInfo
- All Known Subinterfaces:
BeanContextServiceProviderBeanInfo
- All Known Implementing Classes:
SimpleBeanInfo
public interface BeanInfo
BeanInfo
interface to create a BeanInfo
class and provide explicit information about the methods, properties, events, and other features of your beans. When developing your bean, you can implement the bean features required for your application task omitting the rest of the BeanInfo
features. They will be obtained through the automatic analysis by using the low-level reflection of the bean methods and applying standard design patterns. You have an opportunity to provide additional bean information through various descriptor classes.
See the SimpleBeanInfo
class that is a convenient basic class for BeanInfo
classes. You can override the methods and properties of the SimpleBeanInfo
class to define specific information.
See also the Introspector
class to learn more about bean behavior.
- Since:
- 1.1
Field Summary
Modifier and Type | Field | Description |
---|---|---|
static final int |
ICON_COLOR_16x16 |
Constant to indicate a 16 x 16 color icon. |
static final int |
ICON_COLOR_32x32 |
Constant to indicate a 32 x 32 color icon. |
static final int |
ICON_MONO_16x16 |
Constant to indicate a 16 x 16 monochrome icon. |
static final int |
ICON_MONO_32x32 |
Constant to indicate a 32 x 32 monochrome icon. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
BeanInfo[] |
getAdditionalBeanInfo() |
This method enables the current BeanInfo object to return an arbitrary collection of other BeanInfo objects that provide additional information about the current bean. |
BeanDescriptor |
getBeanDescriptor() |
Returns the bean descriptor that provides overall information about the bean, such as its display name or its customizer. |
int |
getDefaultEventIndex() |
A bean may have a default event typically applied when this bean is used. |
int |
getDefaultPropertyIndex() |
A bean may have a default property commonly updated when this bean is customized. |
EventSetDescriptor[] |
getEventSetDescriptors() |
Returns the event descriptors of the bean that define the types of events fired by this bean. |
Image |
getIcon |
Returns an image that can be used to represent the bean in toolboxes or toolbars. |
MethodDescriptor[] |
getMethodDescriptors() |
Returns the method descriptors of the bean that define the externally visible methods supported by this bean. |
PropertyDescriptor[] |
getPropertyDescriptors() |
Returns descriptors for all properties of the bean. |
Field Details
ICON_COLOR_16x16
static final int ICON_COLOR_16x16
- See Also:
ICON_COLOR_32x32
static final int ICON_COLOR_32x32
- See Also:
ICON_MONO_16x16
static final int ICON_MONO_16x16
- See Also:
ICON_MONO_32x32
static final int ICON_MONO_32x32
- See Also:
Method Details
getBeanDescriptor
BeanDescriptor getBeanDescriptor()
- Returns:
- a
BeanDescriptor
object, ornull
if the information is to be obtained through the automatic analysis
getEventSetDescriptors
EventSetDescriptor[] getEventSetDescriptors()
- Returns:
- an array of
EventSetDescriptor
objects, ornull
if the information is to be obtained through the automatic analysis
getDefaultEventIndex
int getDefaultEventIndex()
- Returns:
- index of the default event in the
EventSetDescriptor
array returned by thegetEventSetDescriptors
method, or -1 if there is no default event
getPropertyDescriptors
PropertyDescriptor[] getPropertyDescriptors()
If a property is indexed, then its entry in the result array belongs to the IndexedPropertyDescriptor
subclass of the PropertyDescriptor
class. A client of the getPropertyDescriptors
method can use the instanceof
operator to check whether a given PropertyDescriptor
is an IndexedPropertyDescriptor
.
- Returns:
- an array of
PropertyDescriptor
objects, ornull
if the information is to be obtained through the automatic analysis
getDefaultPropertyIndex
int getDefaultPropertyIndex()
- Returns:
- index of the default property in the
PropertyDescriptor
array returned by thegetPropertyDescriptors
method, or -1 if there is no default property
getMethodDescriptors
MethodDescriptor[] getMethodDescriptors()
- Returns:
- an array of
MethodDescriptor
objects, ornull
if the information is to be obtained through the automatic analysis
getAdditionalBeanInfo
BeanInfo[] getAdditionalBeanInfo()
BeanInfo
object to return an arbitrary collection of other BeanInfo
objects that provide additional information about the current bean. If there are conflicts or overlaps between the information provided by different BeanInfo
objects, the current BeanInfo
object takes priority over the additional BeanInfo
objects. Array elements with higher indices take priority over the elements with lower indices.
- Returns:
- an array of
BeanInfo
objects, ornull
if there are no additionalBeanInfo
objects
getIcon
Image getIcon(int iconKind)
There are four possible types of icons: 16 x 16 color, 32 x 32 color, 16 x 16 mono, and 32 x 32 mono. If you implement a bean so that it supports a single icon, it is recommended to use 16 x 16 color. Another recommendation is to set a transparent background for the icons.
- Parameters:
-
iconKind
- the kind of icon requested - Returns:
- an image object representing the requested icon, or
null
if no suitable icon is available - See Also:
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/beans/BeanInfo.html