java.lang.Object
java.beans.beancontext.BeanContextChildSupport
java.beans.beancontext.BeanContextSupport
- 所有已实现的接口:
BeanContext,BeanContextChild,BeanContextServiceRevokedListener,BeanContextServicesListener,DesignMode,PropertyChangeListener,VetoableChangeListener,Visibility,Serializable,Iterable,Collection,EventListener
public class BeanContextSupport extends BeanContextChildSupport implements BeanContext , Serializable , PropertyChangeListener , VetoableChangeListener
这个帮助器类提供了 java.beans.beancontext.BeanContext 接口的实用程序实现。
由于此类直接实现了 BeanContext 接口,因此该类可以并且旨在通过子类化此实现或通过从另一个类的实例临时委托来使用。
- 自从:
- 1.2
- 参见:
-
内部类总结
内部类修饰符和类型类描述protected class一个受保护的嵌套类,包含children哈希表中的每个子项信息。protected static final classprotected final 子类,它封装了一个迭代器但实现了一个 noop remove() 方法。 -
字段摘要
字段修饰符和类型Field描述protected ArrayList<BeanContextMembershipListener>所有对protected ArrayList bcmListeners字段的访问都应在该对象上同步。protected HashMap<Object,BeanContextSupport.BCSChild> 所有对protected HashMap children字段的访问都应在该对象上同步。protected booleanboolean指示此对象当前是否处于设计时模式。protected Locale此 BeanContext 的当前locale。protected booleanboolean指示此实例现在是否可以呈现 GUI。在类 java.beans.beancontext.BeanContextChildSupport 中声明的字段
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport在接口 java.beans.beancontext.BeanContext 中声明的字段
globalHierarchyLock在接口 java.beans.DesignMode 中声明的字段
PROPERTYNAME -
构造方法总结
构造方法构造方法描述创建一个不是另一个对象的委托的实例使用默认locale创建实例BeanContextSupport(BeanContext peer, Locale lcle) 使用指定locale创建实例BeanContextSupport(BeanContext peer, Locale lcle, boolean dtime) 使用指定的locale和设计模式创建实例。BeanContextSupport(BeanContext peer, Locale lcle, boolean dTime, boolean visible) 构造一个 BeanContextSupport 实例 -
方法总结
修饰符和类型方法描述boolean在这个BeanContext中添加/嵌套一个孩子。booleanaddAll(Collection c) 将集合添加到子集(不支持)实现必须在层次结构锁和“子”保护字段上同步void添加一个 BeanContextMembershipListenerboolean用于确定BeanContext孩子是否正在避免使用其 GUI。protected Iterator<BeanContextSupport.BCSChild>返回此BeanContext的所有子项的迭代器。protected void在 defaultReadObject() 之后但在反序列化任何子对象之前由 readObject 调用。protected void在 defaultWriteObject() 之后但在当前可序列化子对象的序列化之前由 writeObject 调用。protected voidchildDeserializedHook(Object child, BeanContextSupport.BCSChild bcsc) 由带有新反序列化的子对象和 BCSChild 的 readObject 调用。protected voidchildJustAddedHook(Object child, BeanContextSupport.BCSChild bcsc) 子类可以重写此方法以在添加子项之后和事件通知发生之前简单地扩展 add() 语义。protected voidchildJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc) 子类可以重写此方法以在子项被移除之后和事件通知发生之前简单地扩展 remove() 语义。protected static final booleanclassEquals(Class<?> first, Class<?> second) 测试两个类对象或它们的名称是否相等。voidclear()清除子(不支持)实现必须在层次锁和“子”保护字段上同步boolean确定指定对象当前是否是此BeanContext的子对象。boolean测试指定Collection中的所有对象是否都是此BeanContext的子对象。boolean确定指定对象当前是否是此BeanContext的子对象。protected final Object[]获取此 BeanContext 的子项的副本。protected BeanContextSupport.BCSChildcreateBCSChild(Object targetChild, Object peer) 子类可以重写此方法以插入自己的 Child 子类,而不必重写 add() 或其他将子类添加到集合的 Collection 方法。protected final voiddeserialize(ObjectInputStream ois, Collection coll) readObject 使用它来反序列化一个集合。void通知此实例它可能不再呈现 GUI。protected final void在 BeanContextMembershipListener 接口上触发 BeanContextshipEventprotected final void在 BeanContextMembershipListener 接口上触发 BeanContextshipEvent获取此对象为其提供实现的BeanContext实例。protected static final BeanContextChildgetChildBeanContextChild(Object child) 获取指定子项的 BeanContextChild(如果有)protected static final BeanContextMembershipListener获取指定子项的 BeanContextMembershipListener(如果有)protected static final PropertyChangeListener获取指定子项的 PropertyChangeListener(如果有)protected static final SerializablegetChildSerializable(Object child) 获取与指定 Child 关联的 Serializable(如果有)protected static final VetoableChangeListener获取指定子项的 VetoableChangeListener(如果有)protected static final VisibilitygetChildVisibility(Object child) 获取与指定子项关联的 Component(如果有)。获取此BeanContext的locale。getResource(String name, BeanContextChild bcc) 类似于java.lang.ClassLoader.getResource(),此方法允许BeanContext实现在子Component和底层ClassLoader之间插入行为。getResourceAsStream(String name, BeanContextChild bcc) 类似于java.lang.ClassLoader.getResourceAsStream(),此方法允许BeanContext实现在子Component和底层ClassLoader之间插入行为。protected void从构造方法和 readObject 调用的受保护方法来初始化 BeanContextSupport 实例的瞬态。instantiateChild(String beanName) instantiateChild 方法是 BeanContext 中的一个便利挂钩,用于简化将嵌套的 Bean 实例化为BeanContext的任务。boolean报告此对象当前是否处于设计时模式。booleanisEmpty()报告此BeanContext是否为空。boolean这个BeanContext是在连载中吗?iterator()获取当前嵌套在此BeanContext中的所有 JavaBean 或BeanContext实例。booleanneedsGui()通常从环境中调用此方法以确定实现者是否“需要”GUI。void通知此实例它现在可以呈现 GUIvoid子类可以封装以监视子属性的更改。final void当此类的实例用作 BeanContext 协议(及其子协议)实现的委托时,在反序列化期间存在“先有鸡还是先有蛋”的问题boolean从此 BeanContext 中移除一个子项。protected boolean当因意外的setBeanContext或remove()调用导致删除时使用内部删除。boolean删除所有指定的子项(不支持)实现必须在层次结构锁和“子项”保护字段上同步void删除 BeanContextMembershipListenerboolean仅保留指定的子项(不支持)实现必须在层次锁和“子项”保护字段上同步protected final voidserialize(ObjectOutputStream oos, Collection<?> coll) 由 writeObject 用于序列化 Collection。voidsetDesignTime(boolean dTime) 为此BeanContext设置新的设计时间值。void设置此 BeanContext 的locale。intsize()获取当前嵌套在此 BeanContext 中的子项数。Object[]toArray()获取当前嵌套在此 BeanContext 中的所有 JavaBean 或BeanContext实例。Object[]获取一个数组,其中包含此BeanContext的所有子项,这些子项与 arry 中包含的类型相匹配。protected booleanvalidatePendingAdd(Object targetChild) 此类的子类可以重写或封装此方法,以添加BeanContext 的验证行为,以便在将子对象添加到 BeanContext 之前立即对其进行检查。protected booleanvalidatePendingRemove(Object targetChild) 此类的子类可以重写或封装此方法,以添加 BeanContext 的验证行为,以在子对象从 BeanContext 中删除之前立即检查它们。void子类可能会封装以监视否决子属性的更改。final void用于序列化此BeanContext的所有子项。在类 java.beans.beancontext.BeanContextChildSupport 中声明的方法
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext在类 java.lang.Object 中声明的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait在接口 java.beans.beancontext.BeanContextChild 中声明的方法
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext在接口 java.util.Collection 中声明的方法
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
字段详细信息
-
children
所有对protected HashMap children字段的访问都应在该对象上同步。 -
bcmListeners
所有对protected ArrayList bcmListeners字段的访问都应在该对象上同步。 -
locale
此 BeanContext 的当前locale。 -
okToUseGui
protected boolean okToUseGuiboolean指示此实例现在是否可以呈现 GUI。 -
designTime
protected boolean designTimeboolean指示此对象当前是否处于设计时模式。
-
-
构造方法详细信息
-
BeanContextSupport
构造一个 BeanContextSupport 实例- 参数:
peer- 我们正在为其提供实现的对等点BeanContext,或者如果此对象是它自己的对等点,则为nulllcle- 此 BeanContext 的当前locale。如果lcle是null,则默认区域设置分配给BeanContext实例。dTime- 初始状态,true如果处于设计模式,false如果是运行时。visible- 初始可见性。- 参见:
-
BeanContextSupport
使用指定的locale和设计模式创建实例。- 参数:
peer- 我们正在为其提供实现的对等点BeanContext,或者如果此对象是它自己的对等点,则为nulllcle- 此BeanContext的当前locale。如果lcle是null,则默认区域设置分配给BeanContext实例。dtime- 初始状态,true如果处于设计模式,false如果是运行时。- 参见:
-
BeanContextSupport
使用指定locale创建实例- 参数:
peer- 我们为其提供实现的对等 BeanContext,或者null如果此对象是它自己的对等lcle- 此BeanContext的当前locale。如果lcle是null,则默认区域设置分配给BeanContext实例。- 参见:
-
BeanContextSupport
使用默认locale创建实例- 参数:
peer- 我们正在为其提供实现的对等点BeanContext,或者如果此对象是它自己的对等点,则为null
-
BeanContextSupport
public BeanContextSupport()创建一个不是另一个对象的委托的实例
-
-
方法详情
-
getBeanContextPeer
获取此对象为其提供实现的BeanContext实例。- 返回:
- BeanContext 实例
-
instantiateChild
instantiateChild 方法是 BeanContext 中的一个便利挂钩,用于简化将嵌套的 Bean 实例化为
BeanContext的任务。beanName 参数的语义由 java.beans.Beans.instantiate 定义。
- 指定者:
instantiateChild在接口BeanContext中- 参数:
beanName- 要在此 BeanContext 中实例化的 Bean 的名称- 返回:
- 新对象
- 抛出:
IOException- 如果在反序列化 bean 时出现 I/O 错误ClassNotFoundException- 如果找不到由 beanName 参数标识的类
-
size
public int size()获取当前嵌套在此 BeanContext 中的子项数。- 指定者:
size在接口Collection中- 返回:
- 儿童人数
-
isEmpty
public boolean isEmpty()报告此BeanContext是否为空。当BeanContext包含零个嵌套子项时,它被认为是空的。- 指定者:
isEmpty在接口Collection中- 返回:
- 如果没有子级
-
contains
确定指定对象当前是否是此BeanContext的子对象。- 指定者:
contains在接口Collection中- 参数:
o- 有问题的对象- 返回:
- 如果这个对象是一个子级
-
containsKey
确定指定对象当前是否是此BeanContext的子对象。- 参数:
o- 有问题的对象- 返回:
- 如果这个对象是一个子级
-
iterator
获取当前嵌套在此BeanContext中的所有 JavaBean 或BeanContext实例。- 指定者:
iterator在接口Collection中- 指定者:
iterator在接口Iterable中- 返回:
-
嵌套子项的
Iterator
-
toArray
获取当前嵌套在此 BeanContext 中的所有 JavaBean 或BeanContext实例。- 指定者:
toArray在接口Collection中- 返回:
-
一个数组,其 运行时组件类型 为
Object,包含此集合中的所有元素
-
toArray
获取一个数组,其中包含此BeanContext的所有子项,这些子项与 arry 中包含的类型相匹配。- 指定者:
toArray在接口Collection中- 参数:
arry- 感兴趣的对象类型数组。- 返回:
- 一个子元素的数组
-
createBCSChild
子类可以重写此方法以插入自己的 Child 子类,而不必重写 add() 或其他将子类添加到集合的 Collection 方法。
- 参数:
targetChild- 子代创建子代peer- peer 如果 tragetChild 和 peer 通过 BeanContextProxy 的实现相关- 返回:
- Child 的特定于子类型的子类,没有重写集合方法
-
add
在这个BeanContext中添加/嵌套一个孩子。作为 java.beans.Beans.instantiate() 的副作用调用。如果子对象对于添加无效,则此方法抛出 IllegalStateException。
- 指定者:
add在接口Collection中- 参数:
targetChild- 嵌套在这个BeanContext中的子对象- 返回:
- 如果成功添加了子级,则为真。
- 参见:
-
remove
从此 BeanContext 中移除一个子项。如果子对象不用于添加,则此方法抛出 IllegalStateException。- 指定者:
remove在接口Collection中- 参数:
targetChild- 要删除的子对象- 返回:
true如果一个元素作为这个调用的结果被移除- 参见:
-
remove
当因意外的setBeanContext或remove()调用导致删除时使用内部删除。- 参数:
targetChild- 要删除的 JavaBean、BeanContext 或对象callChildSetBC- 用于表示应该通知孩子它不再嵌套在这个BeanContext中。- 返回:
- 在被删除之前是否存在
-
containsAll
测试指定Collection中的所有对象是否都是此BeanContext的子对象。- 指定者:
containsAll在接口Collection中- 参数:
c- 指定的Collection- 返回:
true如果集合中的所有对象都是此BeanContext的子对象,否则为 false。- 参见:
-
addAll
将集合添加到子集(不支持)实现必须在层次结构锁和“子”保护字段上同步- 指定者:
addAll在接口Collection中- 参数:
c- 包含要添加到此集合的元素的集合- 返回:
-
此实现无条件抛出
UnsupportedOperationException - 抛出:
UnsupportedOperationException- 此实现无条件抛出- 参见:
-
removeAll
删除所有指定的子项(不支持)实现必须在层次结构锁和“子项”保护字段上同步- 指定者:
removeAll在接口Collection中- 参数:
c- 包含要从此集合中删除的元素的集合- 返回:
-
此实现无条件抛出
UnsupportedOperationException - 抛出:
UnsupportedOperationException- 此实现无条件抛出- 参见:
-
retainAll
仅保留指定的子项(不支持)实现必须在层次锁和“子项”保护字段上同步- 指定者:
retainAll在接口Collection中- 参数:
c- 包含要保留在此集合中的元素的集合- 返回:
-
此实现无条件抛出
UnsupportedOperationException - 抛出:
UnsupportedOperationException- 此实现无条件抛出- 参见:
-
clear
public void clear()清除子(不支持)实现必须在层次锁和“子”保护字段上同步- 指定者:
clear在接口Collection中- 抛出:
UnsupportedOperationException- 此实现无条件抛出
-
addBeanContextMembershipListener
添加一个 BeanContextMembershipListener- 指定者:
addBeanContextMembershipListener在接口BeanContext中- 参数:
bcml- 要添加的 BeanContextMembershipListener- 抛出:
NullPointerException- 如果参数为空
-
removeBeanContextMembershipListener
删除 BeanContextMembershipListener- 指定者:
removeBeanContextMembershipListener在接口BeanContext中- 参数:
bcml- 要删除的 BeanContextMembershipListener- 抛出:
NullPointerException- 如果参数为空
-
getResourceAsStream
从接口BeanContext复制的描述类似于java.lang.ClassLoader.getResourceAsStream(),此方法允许BeanContext实现在子Component和底层ClassLoader之间插入行为。- 指定者:
getResourceAsStream在接口BeanContext中- 参数:
name- 所请求资源的名称。bcc- 发出请求的子对象。- 返回:
- 请求的资源作为 InputStream
- 抛出:
NullPointerException- 如果参数为空
-
getResource
从接口BeanContext复制的描述类似于java.lang.ClassLoader.getResource(),此方法允许BeanContext实现在子Component和底层ClassLoader之间插入行为。- 指定者:
getResource在接口BeanContext中- 参数:
name- 所请求资源的名称。bcc- 发出请求的子对象。- 返回:
- 请求的资源作为 InputStream
-
setDesignTime
public void setDesignTime(boolean dTime) 为此BeanContext设置新的设计时间值。- 指定者:
setDesignTime在接口DesignMode中- 参数:
dTime- 新的 designTime 值- 参见:
-
isDesignTime
public boolean isDesignTime()报告此对象当前是否处于设计时模式。- 指定者:
isDesignTime在接口DesignMode中- 返回:
true如果处于设计时模式,false如果不是
-
setLocale
设置此 BeanContext 的locale。- 参数:
newLocale- 新locale。如果 newLocale 是null,则此方法调用将无效。- 抛出:
PropertyVetoException- 如果新值被拒绝
-
getLocale
获取此BeanContext的locale。- 返回:
BeanContext的当前locale
-
needsGui
public boolean needsGui()通常从环境中调用此方法以确定实现者是否“需要”GUI。
此处使用的算法测试 BeanContextPeer 及其当前子项以确定它们是否是容器、组件,或者它们是否实现了可见性并返回 needsGui() == true。
- 指定者:
needsGui在接口Visibility中- 返回:
true如果实现者需要 GUI
-
dontUseGui
public void dontUseGui()通知此实例它可能不再呈现 GUI。- 指定者:
dontUseGui在接口Visibility中
-
okToUseGui
public void okToUseGui()通知此实例它现在可以呈现 GUI- 指定者:
okToUseGui在接口Visibility中
-
avoidingGui
public boolean avoidingGui()用于确定BeanContext孩子是否正在避免使用其 GUI。- 指定者:
avoidingGui在接口Visibility中- 返回:
- 此实例是否避免使用其 GUI?
- 参见:
-
isSerializing
public boolean isSerializing()这个BeanContext是在连载中吗?- 返回:
-
如果这个
BeanContext当前正在被序列化
-
bcsChildren
返回此BeanContext的所有子项的迭代器。- 返回:
- 所有当前 BCSChild 值的迭代器
-
bcsPreSerializationHook
在 defaultWriteObject() 之后但在当前可序列化子对象的序列化之前由 writeObject 调用。子类可以重写此方法,以在该超类序列化子类之前对其状态执行自定义序列化。但是,子类不应使用此方法来替换它们自己的 writeObject() 实现(如果有)。- 参数:
oos- 在序列化期间使用的ObjectOutputStream- 抛出:
IOException- 如果序列化失败
-
bcsPreDeserializationHook
protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException , ClassNotFoundException 在 defaultReadObject() 之后但在反序列化任何子对象之前由 readObject 调用。子类可以重写此方法,以在该超类反序列化子类之前对其状态执行自定义反序列化。但是,子类不应使用此方法来替换它们自己的 readObject() 实现(如果有)。- 参数:
ois- 在反序列化期间使用的ObjectInputStream- 抛出:
IOException- 如果反序列化失败ClassNotFoundException- 如果找不到需要的类
-
childDeserializedHook
由带有新反序列化的子对象和 BCSChild 的 readObject 调用。- 参数:
child- 新反序列化的孩子bcsc- 新反序列化的 BCSChild
-
serialize
由 writeObject 用于序列化 Collection。- 参数:
oos- 在序列化期间使用的ObjectOutputStreamcoll- 要序列化的Collection- 抛出:
IOException- 如果序列化失败
-
deserialize
protected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException , ClassNotFoundException readObject 使用它来反序列化一个集合。- 参数:
ois- 要使用的 ObjectInputStreamcoll- Collection- 抛出:
IOException- 如果反序列化失败ClassNotFoundException- 如果找不到需要的类
-
writeChildren
用于序列化此BeanContext的所有子项。- 参数:
oos- 在序列化期间使用的ObjectOutputStream- 抛出:
IOException- 如果序列化失败
-
readChildren
当此类的实例用作 BeanContext 协议(及其子协议)实现的委托时,在反序列化期间存在“先有鸡还是先有蛋”的问题- 参数:
ois- 要使用的 ObjectInputStream- 抛出:
IOException- 如果反序列化失败ClassNotFoundException- 如果找不到需要的类
-
vetoableChange
子类可能会封装以监视否决子属性的更改。- 指定者:
vetoableChange在接口VetoableChangeListener中- 参数:
pce- 一个PropertyChangeEvent对象,描述事件源和已更改的属性。- 抛出:
PropertyVetoException- 如果接收者希望回滚属性更改。
-
propertyChange
子类可以封装以监视子属性的更改。- 指定者:
propertyChange在接口PropertyChangeListener中- 参数:
pce- 描述事件源和已更改属性的 PropertyChangeEvent 对象。
-
validatePendingAdd
此类的子类可以重写或封装此方法,以添加BeanContext 的验证行为,以便在将子对象添加到 BeanContext 之前立即对其进行检查。
- 参数:
targetChild- 子代创建子代- 返回:
- 当且仅当可以将子级添加到此 BeanContext 时为真,否则为假。
-
validatePendingRemove
此类的子类可以重写或封装此方法,以添加 BeanContext 的验证行为,以在子对象从 BeanContext 中删除之前立即检查它们。
- 参数:
targetChild- 子代创建子代- 返回:
- 当且仅当可以从此 BeanContext 中删除子级时为真,否则为假。
-
childJustAddedHook
子类可以重写此方法以在添加子项之后和事件通知发生之前简单地扩展 add() 语义。该方法与子同步调用。- 参数:
child- 孩子bcsc- BCSChild
-
childJustRemovedHook
子类可以重写此方法以在子项被移除之后和事件通知发生之前简单地扩展 remove() 语义。该方法与子同步调用。- 参数:
child- 孩子bcsc- BCSChild
-
getChildVisibility
获取与指定子项关联的 Component(如果有)。- 参数:
child- 指定的孩子- 返回:
- 与指定子项关联的组件(如果有)。
-
getChildSerializable
获取与指定 Child 关联的 Serializable(如果有)- 参数:
child- 指定的孩子- 返回:
- 与指定 Child 关联的 Serializable(如果有)
-
getChildPropertyChangeListener
获取指定子项的 PropertyChangeListener(如果有)- 参数:
child- 指定的孩子- 返回:
- 指定子项的 PropertyChangeListener(如果有)
-
getChildVetoableChangeListener
获取指定子项的 VetoableChangeListener(如果有)- 参数:
child- 指定的孩子- 返回:
- 指定子项的 VetoableChangeListener(如果有)
-
getChildBeanContextMembershipListener
protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object child) 获取指定子项的 BeanContextMembershipListener(如果有)- 参数:
child- 指定的孩子- 返回:
- 指定子级的 BeanContextMembershipListener(如果有)
-
getChildBeanContextChild
获取指定子项的 BeanContextChild(如果有)- 参数:
child- 指定的孩子- 返回:
- 指定子项的 BeanContextChild(如果有)
- 抛出:
IllegalArgumentException- 如果 child 实现了 BeanContextChild 和 BeanContextProxy
-
fireChildrenAdded
在 BeanContextMembershipListener 接口上触发 BeanContextshipEvent- 参数:
bcme- 要触发的事件
-
fireChildrenRemoved
在 BeanContextMembershipListener 接口上触发 BeanContextshipEvent- 参数:
bcme- 要触发的事件
-
initialize
protected void initialize()从构造方法和 readObject 调用的受保护方法来初始化 BeanContextSupport 实例的瞬态。此类使用此方法来实例化用于监视子级上的 PropertyChange 和 VetoableChange 事件的内部类监听。子类可以封装此方法以添加自己的初始化行为 -
copyChildren
获取此 BeanContext 的子项的副本。- 返回:
- 当前嵌套子项的副本
-
classEquals
测试两个类对象或它们的名称是否相等。- 参数:
first- 第一个对象second- 第二个对象- 返回:
- 如果相等则为真,否则为假
-