public interface BeanInfo
BeanInfo界面创建一个BeanInfo类,并提供关于bean的方法,属性,事件和其他功能的显式信息。
在开发您的bean时,您可以实现应用任务所需的bean功能,省略其余的BeanInfo功能。 它们将通过自动分析获得,通过使用低级反射的bean方法和应用标准设计模式。 您有机会通过各种描述符类提供其他bean信息。
见SimpleBeanInfo类,它是一个方便的基本类BeanInfo类。 您可以覆盖SimpleBeanInfo类的方法和属性来定义特定信息。
另请参阅Introspector类以了解有关bean行为的更多信息。
| Modifier and Type | Field and Description |
|---|---|
static int |
ICON_COLOR_16x16
常数表示16 x 16颜色图标。
|
static int |
ICON_COLOR_32x32
常数表示32 x 32颜色图标。
|
static int |
ICON_MONO_16x16
常数表示16 x 16黑白图标。
|
static int |
ICON_MONO_32x32
常数表示32 x 32黑白图标。
|
| Modifier and Type | Method and Description |
|---|---|
BeanInfo[] |
getAdditionalBeanInfo()
此方法使当前的
BeanInfo对象能够返回任何其他
BeanInfo对象的
BeanInfo集合,该对象提供有关当前bean的附加信息。
|
BeanDescriptor |
getBeanDescriptor()
返回提供关于该bean的整体信息的bean描述符,例如其显示名称或其定制器。
|
int |
getDefaultEventIndex()
一个bean可能有一个默认的事件通常应用在这个bean使用。
|
int |
getDefaultPropertyIndex()
当bean定制时,bean可能具有通常更新的默认属性。
|
EventSetDescriptor[] |
getEventSetDescriptors()
返回bean定义此bean触发的事件类型的事件描述符。
|
Image |
getIcon(int iconKind)
返回可用于在工具箱或工具栏中表示bean的图像。
|
MethodDescriptor[] |
getMethodDescriptors()
返回定义此bean支持的外部可见方法的bean的方法描述符。
|
PropertyDescriptor[] |
getPropertyDescriptors()
返回bean的所有属性的描述符。
|
static final int ICON_COLOR_16x16
static final int ICON_COLOR_32x32
static final int ICON_MONO_16x16
static final int ICON_MONO_32x32
BeanDescriptor getBeanDescriptor()
BeanDescriptor对象,或null如果信息是通过自动分析获得的
EventSetDescriptor[] getEventSetDescriptors()
EventSetDescriptor对象的数组,或null如果通过自动分析获得信息
int getDefaultEventIndex()
getEventSetDescriptors方法返回的
EventSetDescriptor阵列中的默认事件的索引,如果没有默认事件则为-1
PropertyDescriptor[] getPropertyDescriptors()
如果属性索引,则其结果阵列中条目属于IndexedPropertyDescriptor子类的PropertyDescriptor类。 getPropertyDescriptors方法的客户端可以使用instanceof运算符来检查给定的PropertyDescriptor是否为IndexedPropertyDescriptor 。
PropertyDescriptor对象,或
null如果信息是通过自动分析获得
int getDefaultPropertyIndex()
getPropertyDescriptors方法返回的
PropertyDescriptor数组中的默认属性的索引,如果没有默认属性,则为-1。
MethodDescriptor[] getMethodDescriptors()
MethodDescriptor个对象,或null如果信息是通过自动分析获得
BeanInfo[] getAdditionalBeanInfo()
BeanInfo对象能够返回任何其他BeanInfo对象的BeanInfo集合,该对象提供有关当前bean的其他信息。
如果由不同的BeanInfo对象提供的信息之间存在冲突或重叠,则当前的BeanInfo对象优先于附加的BeanInfo对象。 具有较高索引的数组元素优先于具有较低索引的元素。
BeanInfo对象的数组,或
null如果没有额外的
BeanInfo对象
Image getIcon(int iconKind)
有四种可能的图标类型:16 x 16色,32 x 32色,16 x 16单声道和32 x 32单声道。 如果您实现一个bean,以便它支持一个图标,建议使用16 x 16颜色。 另一个建议是为图标设置透明背景。
iconKind -
iconKind的图标种类
null如果没有合适的图标可用
ICON_COLOR_16x16 ,
ICON_COLOR_32x32 ,
ICON_MONO_16x16 ,
ICON_MONO_32x32
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.