- 所有已知的子接口:
BeanContext,BeanContextServices
public interface BeanContextChild
希望嵌套在其中并获得对其执行环境或上下文的引用的 JavaBeans,如 BeanContext 子接口所定义,应实现此接口。
作为添加 BeanContextChild 对象的副作用,符合要求的 BeanContexts 应通过此接口的 setBeanContext() 方法传递对自身的引用。
请注意,BeanContextChild 可以通过抛出 PropertyVetoedException 作为响应来拒绝状态更改。
为了使持久性机制在各种场景中在 BeanContextChild 实例上正常运行,需要实现此接口的类来定义瞬态、任何或所有字段或实例变量,这些字段可能包含或表示对嵌套的引用BeanContext 实例或通过任何未指定的机制从 BeanContext 获得的其他资源。
- 自从:
- 1.2
- 参见:
-
方法总结
修饰符和类型方法描述void将PropertyChangeListener添加到此BeanContextChild,以便在指定属性发生更改时接收PropertyChangeEvent。void将VetoableChangeListener添加到此BeanContextChild以在指定属性更改时接收事件。获取与此BeanContextChild关联的BeanContext。void从此BeanContextChild中删除一个PropertyChangeListener,以便它在更改指定属性时不再接收PropertyChangeEvents。void从此BeanContextChild中删除一个VetoableChangeListener,以便它在指定的属性更改时不再接收事件。void实现此接口的对象应触发 java.beans.PropertyChangeEvent,参数为:propertyName“beanContext”,oldValue(前一个嵌套BeanContext实例,或null),newValue(当前嵌套BeanContext实例,或null)。
-
方法详情
-
setBeanContext
实现此接口的对象应触发 java.beans.PropertyChangeEvent,参数为:propertyName“beanContext”,oldValue(前一个嵌套
BeanContext实例,或null),newValue(当前嵌套BeanContext实例,或null)。可以通过抛出适当的异常来否决此 BeanContextChild 的嵌套 BeanContext 属性值的更改。
- 参数:
bc- 与此BeanContextChild关联的BeanContext。- 抛出:
PropertyVetoException- 如果添加指定的BeanContext被拒绝。
-
getBeanContext
BeanContext getBeanContext()获取与此BeanContextChild关联的BeanContext。- 返回:
-
与此
BeanContextChild关联的BeanContext。
-
addPropertyChangeListener
将PropertyChangeListener添加到此BeanContextChild,以便在指定属性发生更改时接收PropertyChangeEvent。- 参数:
name- 要监听的属性的名称pcl- 要添加的PropertyChangeListener
-
removePropertyChangeListener
从此BeanContextChild中删除一个PropertyChangeListener,以便它在更改指定属性时不再接收PropertyChangeEvents。- 参数:
name- 被监听的属性的名称pcl- 要移除的PropertyChangeListener
-
addVetoableChangeListener
将VetoableChangeListener添加到此BeanContextChild以在指定属性更改时接收事件。- 参数:
name- 要监听的属性的名称vcl- 要添加的VetoableChangeListener
-
removeVetoableChangeListener
从此BeanContextChild中删除一个VetoableChangeListener,以便它在指定的属性更改时不再接收事件。- 参数:
name- 被监听的属性的名称。vcl- 要删除的VetoableChangeListener。
-