JavaTM 2 Platform
Standard Ed. 6

java.beans.beancontext
类 BeanContextSupport

java.lang.Object
  继承者 java.beans.beancontext.BeanContextChildSupport
      继承者 java.beans.beancontext.BeanContextSupport
所有已实现的接口:
BeanContext, BeanContextChild, BeanContextServiceRevokedListener, BeanContextServicesListener, DesignMode, PropertyChangeListener, VetoableChangeListener, Visibility, Serializable, Iterable, Collection, EventListener
直接已知子类:
BeanContextServicesSupport

public class BeanContextSupport
extends BeanContextChildSupport
implements BeanContext, Serializable, PropertyChangeListener, VetoableChangeListener

此帮助器类提供 java.beans.beancontext.BeanContext 接口的实用工具实现。

因为此类直接实现 BeanContext 接口,所以可以通过创建此实现的子类来使用该类,或者由另一个实例对此类实例的特别委托来使用该类。

从以下版本开始:
1.2
另请参见:
序列化表格

嵌套类摘要
protected  class BeanContextSupport.BCSChild
           
protected static class BeanContextSupport.BCSIterator
          受保护的最终子类,它封装一个迭代器但实现无操作 remove() 方法。
 
字段摘要
protected  ArrayList bcmListeners
           protected ArrayList bcmListeners 字段的所有访问在该对象上都将是同步的。
protected  HashMap children
           protected HashMap children 字段的所有访问在该对象上都将是同步的。
protected  boolean designTime
          指示此对象目前是否处于设计时间模式下的 boolean 值。
protected  Locale locale
          此 BeanContext 的当前语言环境。
protected  boolean okToUseGui
          指示此实例现在能否呈现 GUI 的 boolean 值。
 
从类 java.beans.beancontext.BeanContextChildSupport 继承的字段
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
从接口 java.beans.beancontext.BeanContext 继承的字段
globalHierarchyLock
 
从接口 java.beans.DesignMode 继承的字段
PROPERTYNAME
 
构造方法摘要
BeanContextSupport()
          创建不是另一个对象代理的实例。
BeanContextSupport(BeanContext peer)
          使用默认语言环境创建一个实例
BeanContextSupport(BeanContext peer, Locale lcle)
          使用指定语言环境创建一个实例。
BeanContextSupport(BeanContext peer, Locale lcle, boolean dtime)
          使用指定 Locale 和设计模式创建一个实例。
BeanContextSupport(BeanContext peer, Locale lcle, boolean dTime, boolean visible)
          构造一个 BeanContextSupport 实例。
 
方法摘要
 boolean add(Object targetChild)
          在此 BeanContext 中添加/嵌套一个子级。
 boolean addAll(Collection c)
          将 Collection 添加到 Children(不受支持的)实现的集合,这些实现在层次结构锁定和 "children" 受保护字段上必须是同步的
 void addBeanContextMembershipListener(BeanContextMembershipListener bcml)
          添加一个 BeanContextMembershipListener。
 boolean avoidingGui()
          用于确定 BeanContext 子级是否避免使用其 GUI。
protected  Iterator bcsChildren()
          返回此 BeanContext 所有子级的迭代器。
protected  void bcsPreDeserializationHook(ObjectInputStream ois)
          在调用 defaultReadObject() 之后,但在反序列化任意子级之前,由 readObject 调用。
protected  void bcsPreSerializationHook(ObjectOutputStream oos)
          在调用 defaultWriteObject() 之后,但在序列化当前可序列化子级之前,由 writeObject 调用。
protected  void childDeserializedHook(Object child, BeanContextSupport.BCSChild bcsc)
          由 readObject 利用新近反序列化的子级和 BCSChild 调用。
protected  void childJustAddedHook(Object child, BeanContextSupport.BCSChild bcsc)
          子类可以重写此方法,以便在已经添加子对象之后,且在发生事件通知之前,只扩展 add() 语义。
protected  void childJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc)
          子类可以重写此方法,以便在已经移除子对象之后,且在发生事件通知之前,只扩展 remove() 语义。
protected static boolean classEquals(Class first, Class second)
          测试以查看两个类对象或其名称是否相等。
 void clear()
          清除子对象(不受支持的)实现,这些实现在分层结构锁定和 "children" 受保护字段上必须是同步的
 boolean contains(Object o)
          确定指定对象当前是否是此 BeanContext 的子级。
 boolean containsAll(Collection c)
          测试以查看指定 Collection 中的所有对象是否是此 BeanContext 的子对象。
 boolean containsKey(Object o)
          确定指定对象当前是否是此 BeanContext 的子级。
protected  Object[] copyChildren()
          获得此 BeanContext 子级的副本。
protected  BeanContextSupport.BCSChild createBCSChild(Object targetChild, Object peer)
           子类可以重写此方法来插入自己的 Child 的子类,而不必重写 add() 或其他将子级添加到集合中的 Collection 方法。
protected  void deserialize(ObjectInputStream ois, Collection coll)
          readObject 使用此方法来反序列化一个 collection。
 void dontUseGui()
          通知此实例它可以不再呈现一个 GUI。
protected  void fireChildrenAdded(BeanContextMembershipEvent bcme)
          在 BeanContextMembershipListener 接口上触发一个 BeanContextshipEvent。
protected  void fireChildrenRemoved(BeanContextMembershipEvent bcme)
          在 BeanContextMembershipListener 接口上触发一个 BeanContextshipEvent。
 BeanContext getBeanContextPeer()
          获得 BeanContext 的实例,此对象将为其提供实现。
protected static BeanContextChild getChildBeanContextChild(Object child)
          与指定 Child 相关联的 BeanContextChild(如果有)。
protected static BeanContextMembershipListener getChildBeanContextMembershipListener(Object child)
          与指定 Child 相关联的 BeanContextMembershipListener(如果有)。
protected static PropertyChangeListener getChildPropertyChangeListener(Object child)
          与指定 Child 相关联的 PropertyChangeListener(如果有)
protected static Serializable getChildSerializable(Object child)
          获得与指定 Child 相关联的 Serializable(如果有)
protected static VetoableChangeListener getChildVetoableChangeListener(Object child)
          与指定 Child 相关联的 VetoableChangeListener(如果有)。
protected static Visibility getChildVisibility(Object child)
          获得与指定子级相关联的 Component(如果有)。
 Locale getLocale()
          获得此 BeanContext 的语言环境。
 URL getResource(String name, BeanContextChild bcc)
          与 java.lang.ClassLoader.getResource() 类似,此方法允许 BeanContext 实现协调子 Component 和基础 ClassLoader 之间的行为。
 InputStream getResourceAsStream(String name, BeanContextChild bcc)
          与 java.lang.ClassLoader.getResourceAsStream() 类似,此方法允许 BeanContext 实现协调子 Component 和基础 ClassLoader 之间的行为。
protected  void initialize()
          从构造方法和 readObject 调用的受保护方法,以初始化 BeanContextSupport 实例的瞬态。
 Object instantiateChild(String beanName)
           instantiateChild 方法是 BeanContext 中的便捷钩子 (hook),用来简化将嵌套的 Bean 实例化为 BeanContext 这项任务。
 boolean isDesignTime()
          报告此对象当前是否处于设计时间模式下。
 boolean isEmpty()
          报告此 BeanContext 是否为空。
 boolean isSerializing()
          此 BeanContext 正处于序列化过程中吗?
 Iterator iterator()
          获得当前嵌套在此 BeanContext 中的所有 JavaBean 或 BeanContext 实例。
 boolean needsGui()
           此方法通常从环境中调用,以便确定实现者是否“需要” GUI。
 void okToUseGui()
          通知此实例它现在可以呈现一个 GUI。
 void propertyChange(PropertyChangeEvent pce)
          子类可以封装此方法来监视子类属性的更改。
 void readChildren(ObjectInputStream ois)
          在将此类的实例用作 BeanContext 协议(及其子协议)实现的代理时,在反序列化期间存在一个“先有鸡还是先有蛋”的问题。
 boolean remove(Object targetChild)
          从此 BeanContext 中移除一个子对象。
protected  boolean remove(Object targetChild, boolean callChildSetBC)
          当由意外的 setBeanContextremove() 调用导致移除时使用的内部移除方法。
 boolean removeAll(Collection c)
          移除所有指定 Children(不受支持的)实现,这些实现在层次结构锁定和 "children" 受保护字段上必须是同步的
 void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)
          移除一个 BeanContextMembershipListener。
 boolean retainAll(Collection c)
          仅保留指定子对象(不受支持的)实现,这些实现在层次结构锁定和 "children" 受保护字段上必须是同步的
protected  void serialize(ObjectOutputStream oos, Collection coll)
          writeObject 使用此方法来序列化一个 Collection。
 void setDesignTime(boolean dTime)
          为此 BeanContext 设置新的设计时间值。
 void setLocale(Locale newLocale)
          设置此 BeanContext 的语言环境。
 int size()
          获得当前嵌套在此 BeanContext 中的子级数。
 Object[] toArray()
          获得当前嵌套在此 BeanContext 中的所有 JavaBean 或 BeanContext 实例。
 Object[] toArray(Object[] arry)
          获得包含与数组中所包含类型匹配的此 BeanContext 的所有子级的数组。
protected  boolean validatePendingAdd(Object targetChild)
           此类的子类可以重写或封装此方法,以便为 BeanContext 添加有效行为,从而能在将子对象添加到 BeanContext 之前立即检查它们。
protected  boolean validatePendingRemove(Object targetChild)
           此类的子类可以重写或封装此方法,以便为 BeanContext 添加有效行为,从而能在将子对象从 BeanContext 中移除之前立即检查它们。
 void vetoableChange(PropertyChangeEvent pce)
          子类可以封装此方法来监视子类属性的更改。
 void writeChildren(ObjectOutputStream oos)
          用于序列化此 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
 

字段详细信息

children

protected transient HashMap children
protected HashMap children 字段的所有访问在该对象上都将是同步的。


bcmListeners

protected transient ArrayList bcmListeners
protected ArrayList bcmListeners 字段的所有访问在该对象上都将是同步的。


locale

protected Locale locale
此 BeanContext 的当前语言环境。


okToUseGui

protected boolean okToUseGui
指示此实例现在能否呈现 GUI 的 boolean 值。


designTime

protected boolean designTime
指示此对象目前是否处于设计时间模式下的 boolean 值。

构造方法详细信息

BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          Locale lcle,
                          boolean dTime,
                          boolean visible)
构造一个 BeanContextSupport 实例。

参数:
peer - 将为其提供实现的同位体 BeanContext,如果此对象是它自己的同位体,则该参数为 null
lcle - 此 BeanContext 的当前 Locale。如果 lclenull,则默认语言环境被分配给 BeanContext 实例。
dTime - 初始状态,如果在设计模式下,则该参数为 true,如果在运行状态下,则该参数为 false
visible - 初始可见性。
另请参见:
Locale.getDefault(), Locale.setDefault(java.util.Locale)

BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          Locale lcle,
                          boolean dtime)
使用指定 Locale 和设计模式创建一个实例。

参数:
peer - 将为其提供实现的同位体 BeanContext,如果此对象是它自己的同位体,则该参数为 null
lcle - 此 BeanContext 的当前 Locale。如果 lclenull,则默认语言环境被分配给 BeanContext 实例。
dtime - 初始状态,如果在设计模式下,则该参数为 true,如果在运行状态下,则该参数为 false
另请参见:
Locale.getDefault(), Locale.setDefault(java.util.Locale)

BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          Locale lcle)
使用指定语言环境创建一个实例。

参数:
peer - 将为其提供实现的同位体 BeanContext,如果此对象是它自己的同位体,则该参数为 null
lcle - 此 BeanContext 的当前 Locale。如果 lclenull,则默认语言环境被分配给 BeanContext 实例。
另请参见:
Locale.getDefault(), Locale.setDefault(java.util.Locale)

BeanContextSupport

public BeanContextSupport(BeanContext peer)
使用默认语言环境创建一个实例

参数:
peer - 将为其提供实现的同位体 BeanContext,如果此对象是它自己的同位体,则该参数为 null

BeanContextSupport

public BeanContextSupport()
创建不是另一个对象代理的实例。

方法详细信息

getBeanContextPeer

public BeanContext getBeanContextPeer()
获得 BeanContext 的实例,此对象将为其提供实现。

返回:
BeanContext 实例

instantiateChild

public Object instantiateChild(String beanName)
                        throws IOException,
                               ClassNotFoundException

instantiateChild 方法是 BeanContext 中的便捷钩子 (hook),用来简化将嵌套的 Bean 实例化为 BeanContext 这项任务。

beanName 参数的语义由 java.beans.Beans.instantate 定义。

指定者:
接口 BeanContext 中的 instantiateChild
参数:
beanName - 要在此 BeanContext 中实例化的 Bean 的名称
返回:
新对象
抛出:
IOException - 如果在该 bean 正被反序列化时发生 I/O 错误
ClassNotFoundException - 如果没有找到由 beanName 参数标识的类

size

public int size()
获得当前嵌套在此 BeanContext 中的子级数。

指定者:
接口 Collection 中的 size
返回:
子级数

isEmpty

public boolean isEmpty()
报告此 BeanContext 是否为空。当 BeanContext 不包含任何嵌套子级时,可认为它为空。

指定者:
接口 Collection 中的 isEmpty
返回:
如果没有子级

contains

public boolean contains(Object o)
确定指定对象当前是否是此 BeanContext 的子级。

指定者:
接口 Collection 中的 contains
参数:
o - 相关 Object
返回:
如果此对象是一个子对象

containsKey

public boolean containsKey(Object o)
确定指定对象当前是否是此 BeanContext 的子级。

参数:
o - 相关 Object
返回:
如果此对象是一个子对象

iterator

public Iterator iterator()
获得当前嵌套在此 BeanContext 中的所有 JavaBean 或 BeanContext 实例。

指定者:
接口 Iterable 中的 iterator
指定者:
接口 Collection 中的 iterator
返回:
嵌套子级的 Iterator

toArray

public Object[] toArray()
获得当前嵌套在此 BeanContext 中的所有 JavaBean 或 BeanContext 实例。

指定者:
接口 Collection 中的 toArray
返回:
包含此 collection 中所有元素的数组

toArray

public Object[] toArray(Object[] arry)
获得包含与数组中所包含类型匹配的此 BeanContext 的所有子级的数组。

指定者:
接口 Collection 中的 toArray
参数:
arry - 感兴趣的对象类型数组。
返回:
子级的数组

createBCSChild

protected BeanContextSupport.BCSChild createBCSChild(Object targetChild,
                                                     Object peer)

子类可以重写此方法来插入自己的 Child 的子类,而不必重写 add() 或其他将子级添加到集合中的 Collection 方法。

参数:
targetChild - 要创建自己的 Child 的子级
peer - 同位体,如果 tragetChild 和同位体通过实现 BeanContextProxy 建立联系

add

public boolean add(Object targetChild)
在此 BeanContext 中添加/嵌套一个子级。

作为 java.beans.Beans.instantiate() 的副作用调用。如果子对象对于添加无效,则此方法抛出 IllegalStateException。

指定者:
接口 Collection 中的 add
参数:
targetChild - 嵌套在此 BeanContext 中的子对象
返回:
如果成功添加了子对象,则返回 true。
另请参见:
validatePendingAdd(java.lang.Object)

remove

public boolean remove(Object targetChild)
从此 BeanContext 中移除一个子对象。如果子对象不适用于添加,则此方法抛出 IllegalStateException。

指定者:
接口 Collection 中的 remove
参数:
targetChild - 要移除的子对象
返回:
如果此调用将移除一个元素,则返回 true
另请参见:
validatePendingRemove(java.lang.Object)

remove

protected boolean remove(Object targetChild,
                         boolean callChildSetBC)
当由意外的 setBeanContextremove() 调用导致移除时使用的内部移除方法。

参数:
targetChild - 要移除的 JavaBean、BeanContext 或 Object
callChildSetBC - 用于指示应该通知子对象它不再嵌套在此 BeanContext 中。

containsAll

public boolean containsAll(Collection c)
测试以查看指定 Collection 中的所有对象是否是此 BeanContext 的子对象。

指定者:
接口 Collection 中的 containsAll
参数:
c - 指定的 Collection
返回:
如果 collection 中的所有对象都是此 BeanContext 的子对象,则返回 true,否则返回 false。
另请参见:
Collection.contains(Object)

addAll

public boolean addAll(Collection c)
将 Collection 添加到 Children(不受支持的)实现的集合,这些实现在层次结构锁定和 "children" 受保护字段上必须是同步的

指定者:
接口 Collection 中的 addAll
参数:
c - 包含要添加到此 collection 的元素的 collection
返回:
如果此 collection 由于调用而发生更改,则返回 true
抛出:
UnsupportedOperationException
另请参见:
Collection.add(Object)

removeAll

public boolean removeAll(Collection c)
移除所有指定 Children(不受支持的)实现,这些实现在层次结构锁定和 "children" 受保护字段上必须是同步的

指定者:
接口 Collection 中的 removeAll
参数:
c - 办好要从此 collection 移除的元素的 collection
返回:
如果此 collection 由于调用而发生更改,则返回 true
抛出:
UnsupportedOperationException
另请参见:
Collection.remove(Object), Collection.contains(Object)

retainAll

public boolean retainAll(Collection c)
仅保留指定子对象(不受支持的)实现,这些实现在层次结构锁定和 "children" 受保护字段上必须是同步的

指定者:
接口 Collection 中的 retainAll
参数:
c - 包含保留在此 collection 中的元素的 collection
返回:
如果此 collection 由于调用而发生更改,则返回 true
抛出:
UnsupportedOperationException
另请参见:
Collection.remove(Object), Collection.contains(Object)

clear

public void clear()
清除子对象(不受支持的)实现,这些实现在分层结构锁定和 "children" 受保护字段上必须是同步的

指定者:
接口 Collection 中的 clear
抛出:
UnsupportedOperationException

addBeanContextMembershipListener

public void addBeanContextMembershipListener(BeanContextMembershipListener bcml)
添加一个 BeanContextMembershipListener。

指定者:
接口 BeanContext 中的 addBeanContextMembershipListener
参数:
bcml - 要添加的 BeanContextMembershipListener
抛出:
NullPointerException

removeBeanContextMembershipListener

public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)
移除一个 BeanContextMembershipListener。

指定者:
接口 BeanContext 中的 removeBeanContextMembershipListener
参数:
bcml - 要移除的 BeanContextMembershipListener
抛出:
NullPointerException

getResourceAsStream

public InputStream getResourceAsStream(String name,
                                       BeanContextChild bcc)
从接口 BeanContext 复制的描述
java.lang.ClassLoader.getResourceAsStream() 类似,此方法允许 BeanContext 实现协调子 Component 和基础 ClassLoader 之间的行为。

指定者:
接口 BeanContext 中的 getResourceAsStream
参数:
name - 所需资源的名称。
bcc - 做出请求的子对象。
返回:
以 InputStream 形式返回所需的资源
抛出:
NullPointerException

getResource

public URL getResource(String name,
                       BeanContextChild bcc)
从接口 BeanContext 复制的描述
java.lang.ClassLoader.getResource() 类似,此方法允许 BeanContext 实现协调子 Component 和基础 ClassLoader 之间的行为。

指定者:
接口 BeanContext 中的 getResource
参数:
name - 所需资源的名称。
bcc - 做出请求的子对象。
返回:
以 InputStream 形式返回所需的资源

setDesignTime

public void setDesignTime(boolean dTime)
为此 BeanContext 设置新的设计时间值。

指定者:
接口 DesignMode 中的 setDesignTime
参数:
新的 - designTime 值
另请参见:
BeanContext, BeanContextMembershipListener, PropertyChangeEvent

isDesignTime

public boolean isDesignTime()
报告此对象当前是否处于设计时间模式下。

指定者:
接口 DesignMode 中的 isDesignTime
返回:
如果处于设计时间模式下,则返回 true,否则返回 false

setLocale

public void setLocale(Locale newLocale)
               throws PropertyVetoException
设置此 BeanContext 的语言环境。

参数:
newLocale - 新的语言环境。如果 newLocale 为 null,则此方法调用将无效。
抛出:
PropertyVetoException - 如果拒绝新值。

getLocale

public Locale getLocale()
获得此 BeanContext 的语言环境。

返回:
BeanContext 的当前 Locale

needsGui

public boolean needsGui()

此方法通常从环境中调用,以便确定实现者是否“需要” GUI。

这里使用的算法测试 BeanContextPeer 及其当前子级,以确定它们是 Container 还是 Component,或者确定它们是否实现 Visibility 并返回 needsGui() == true。

指定者:
接口 Visibility 中的 needsGui
返回:
如果实现者需要一个 GUI,则返回 true

dontUseGui

public void dontUseGui()
通知此实例它可以不再呈现一个 GUI。

指定者:
接口 Visibility 中的 dontUseGui

okToUseGui

public void okToUseGui()
通知此实例它现在可以呈现一个 GUI。

指定者:
接口 Visibility 中的 okToUseGui

avoidingGui

public boolean avoidingGui()
用于确定 BeanContext 子级是否避免使用其 GUI。

指定者:
接口 Visibility 中的 avoidingGui
返回:
此实例避免使用其 GUI 吗?
另请参见:
Visibility

isSerializing

public boolean isSerializing()
BeanContext 正处于序列化过程中吗?

返回:
BeanContext 当前是否正被序列化

bcsChildren

protected Iterator bcsChildren()
返回此 BeanContext 所有子级的迭代器。

返回:
用于所有当前 BCSChild 值的迭代器

bcsPreSerializationHook

protected void bcsPreSerializationHook(ObjectOutputStream oos)
                                throws IOException
在调用 defaultWriteObject() 之后,但在序列化当前可序列化子级之前,由 writeObject 调用。 子类可重写此方法,以在此超类序列化子级之前对其状态执行自定义序列化。 不过,此方法不应由子类用于替换它们自己的 writeObject() 实现(如果有)。

抛出:
IOException

bcsPreDeserializationHook

protected void bcsPreDeserializationHook(ObjectInputStream ois)
                                  throws IOException,
                                         ClassNotFoundException
在调用 defaultReadObject() 之后,但在反序列化任意子级之前,由 readObject 调用。 子类可重写此方法,以在此超类反序列化子级之前对其状态执行自定义反序列化。 不过,此方法不应由子类用于替换它们自己的 readObject() 实现(如果有)。

抛出:
IOException
ClassNotFoundException

childDeserializedHook

protected void childDeserializedHook(Object child,
                                     BeanContextSupport.BCSChild bcsc)
由 readObject 利用新近反序列化的子级和 BCSChild 调用。

参数:
child - 新近反序列化的子级
bcsc - 新近反序列化的 BCSChild

serialize

protected final void serialize(ObjectOutputStream oos,
                               Collection coll)
                        throws IOException
writeObject 使用此方法来序列化一个 Collection。

参数:
oos - 序列化期间将使用的 ObjectOutputStream
coll - 要序列化的 Collection
抛出:
IOException - 如果序列化失败

deserialize

protected final void deserialize(ObjectInputStream ois,
                                 Collection coll)
                          throws IOException,
                                 ClassNotFoundException
readObject 使用此方法来反序列化一个 collection。

参数:
ois - 要使用的 ObjectInputStream
coll - Collection
抛出:
IOException
ClassNotFoundException

writeChildren

public final void writeChildren(ObjectOutputStream oos)
                         throws IOException
用于序列化此 BeanContext 的所有子级。

参数:
oos - 序列化期间将使用的 ObjectOutputStream
抛出:
IOException - 如果序列化失败

readChildren

public final void readChildren(ObjectInputStream ois)
                        throws IOException,
                               ClassNotFoundException
在将此类的实例用作 BeanContext 协议(及其子协议)实现的代理时,在反序列化期间存在一个“先有鸡还是先有蛋”的问题。

抛出:
IOException
ClassNotFoundException

vetoableChange

public void vetoableChange(PropertyChangeEvent pce)
                    throws PropertyVetoException
子类可以封装此方法来监视子类属性的更改。

指定者:
接口 VetoableChangeListener 中的 vetoableChange
参数:
pce - 描述事件源和已更改属性的 PropertyChangeEvent 对象。
抛出:
PropertyVetoException - 如果接收方希望回滚属性更改。

propertyChange

public void propertyChange(PropertyChangeEvent pce)
子类可以封装此方法来监视子类属性的更改。

指定者:
接口 PropertyChangeListener 中的 propertyChange
参数:
pce - 描述事件源和已更改属性的 PropertyChangeEvent 对象。

validatePendingAdd

protected boolean validatePendingAdd(Object targetChild)

此类的子类可以重写或封装此方法,以便为 BeanContext 添加有效行为,从而能在将子对象添加到 BeanContext 之前立即检查它们。

返回:
如果可以将子对象添加到此 BeanContext 中,则返回 true,否则返回 false。

validatePendingRemove

protected boolean validatePendingRemove(Object targetChild)

此类的子类可以重写或封装此方法,以便为 BeanContext 添加有效行为,从而能在将子对象从 BeanContext 中移除之前立即检查它们。

返回:
如果可以从此 BeanContext 中移除子对象,则返回 true,否则返回 false。

childJustAddedHook

protected void childJustAddedHook(Object child,
                                  BeanContextSupport.BCSChild bcsc)
子类可以重写此方法,以便在已经添加子对象之后,且在发生事件通知之前,只扩展 add() 语义。该方法使用同步的子对象调用。


childJustRemovedHook

protected void childJustRemovedHook(Object child,
                                    BeanContextSupport.BCSChild bcsc)
子类可以重写此方法,以便在已经移除子对象之后,且在发生事件通知之前,只扩展 remove() 语义。该方法使用同步的子对象调用。


getChildVisibility

protected static final Visibility getChildVisibility(Object child)
获得与指定子级相关联的 Component(如果有)。

参数:
child - 指定子级
返回:
与指定子级相关联的 Component(如果有)。

getChildSerializable

protected static final Serializable getChildSerializable(Object child)
获得与指定 Child 相关联的 Serializable(如果有)

参数:
child - 指定子级
返回:
与指定 Child 相关联的 Serializable(如果有)

getChildPropertyChangeListener

protected static final PropertyChangeListener getChildPropertyChangeListener(Object child)
与指定 Child 相关联的 PropertyChangeListener(如果有)

参数:
child - 指定子级
返回:
与指定子级相关联的 PropertyChangeListener(如果有)

getChildVetoableChangeListener

protected static final VetoableChangeListener getChildVetoableChangeListener(Object child)
与指定 Child 相关联的 VetoableChangeListener(如果有)。

参数:
child - 指定子级
返回:
与指定子级相关联的 VetoableChangeListener(如果有)

getChildBeanContextMembershipListener

protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object child)
与指定 Child 相关联的 BeanContextMembershipListener(如果有)。

参数:
child - 指定子级
返回:
与指定子级相关联的 BeanContextMembershipListener(如果有)

getChildBeanContextChild

protected static final BeanContextChild getChildBeanContextChild(Object child)
与指定 Child 相关联的 BeanContextChild(如果有)。

参数:
child - 指定子级
返回:
与指定子级相关联的 BeanContextChild(如果有)
抛出:
IllegalArgumentException - 如果子级既实现 BeanContextChild 又实现 BeanContextProxy

fireChildrenAdded

protected final void fireChildrenAdded(BeanContextMembershipEvent bcme)
在 BeanContextMembershipListener 接口上触发一个 BeanContextshipEvent。


fireChildrenRemoved

protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme)
在 BeanContextMembershipListener 接口上触发一个 BeanContextshipEvent。


initialize

protected void initialize()
从构造方法和 readObject 调用的受保护方法,以初始化 BeanContextSupport 实例的瞬态。 该类使用此方法来实例化用于监视子级上的 PropertyChange 和 VetoableChange 事件的内部类侦听器。 子类可以封装此方法来添加自己的初始化行为。


copyChildren

protected final Object[] copyChildren()
获得此 BeanContext 子级的副本。

返回:
当前嵌套子级的副本

classEquals

protected static final boolean classEquals(Class first,
                                           Class second)
测试以查看两个类对象或其名称是否相等。

参数:
first - 第一个对象
second - 第二个对象
返回:
如果两个对象相等,则返回 true,否则返回 false

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only