java.lang.Object
java.beans.beancontext.BeanContextChildSupport
java.beans.beancontext.BeanContextSupport
java.beans.beancontext.BeanContextServicesSupport
- 所有已实现的接口:
BeanContext,BeanContextChild,BeanContextServiceRevokedListener,BeanContextServices,BeanContextServicesListener,DesignMode,PropertyChangeListener,VetoableChangeListener,Visibility,Serializable,Iterable,Collection,EventListener
这个帮助器类提供了 java.beans.beancontext.BeanContextServices 接口的实用程序实现。
由于此类直接实现了 BeanContextServices 接口,因此该类可以并且旨在通过子类化此实现来使用,或者通过 BeanContextProxy 接口从另一个类的实例委托来使用。
- 自从:
- 1.2
- 参见:
-
内部类总结
内部类修饰符和类型类描述protected class一个受保护的嵌套类,包含children哈希表中的每个子项信息。protected class子类可以子类化这个嵌套类来表示每个 BeanContextServiceProvider 的代理。protected static class子类可以子类化这个内部类来为每个 BeanContextServicesProvider 添加行为。在类 java.beans.beancontext.BeanContextSupport 中声明的嵌套类/接口
BeanContextSupport.BCSChild, BeanContextSupport.BCSIterator -
字段摘要
字段修饰符和类型Field描述protected ArrayList<BeanContextServicesListener>BeanContextServicesListener对象列表。代表BeanContextServiceProvider。protected int可序列化BeanContextServceProvider的实例数。对protected transient HashMap services字段的所有访问都应在该对象上同步在类 java.beans.beancontext.BeanContextSupport 中声明的字段
bcmListeners, children, designTime, locale, okToUseGui在类 java.beans.beancontext.BeanContextChildSupport 中声明的字段
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport在接口 java.beans.beancontext.BeanContext 中声明的字段
globalHierarchyLock在接口 java.beans.DesignMode 中声明的字段
PROPERTYNAME -
构造方法总结
构造方法构造方法描述创建一个不是另一个对象的委托的实例创建具有对等体的实例BeanContextServicesSupport(BeanContextServices peer, Locale lcle) 使用指定locale创建实例BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dtime) 使用指定的locale和设计模式创建实例。BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dTime, boolean visible) 构造一个 BeanContextServicesSupport 实例 -
方法总结
修饰符和类型方法描述void添加一个 BeanContextServicesListenerbooleanaddService(Class<?> serviceClass, BeanContextServiceProvider bcsp) 添加服务protected booleanaddService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) 添加服务protected void在反序列化子项之前从 BeanContextSupport readObject 调用...protected void在序列化子级之前从 BeanContextSupport writeObject 调用...protected voidchildJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc) 在成功删除子项后从超类子项删除操作中调用。与子同步调用。protected BeanContextSupport.BCSChildcreateBCSChild(Object targetChild, Object peer) 子类可以重写此方法以插入自己的 Child 子类,而不必重写 add() 或其他将子类添加到集合的 Collection 方法。createBCSSServiceProvider(Class<?> sc, BeanContextServiceProvider bcsp) 子类可以重写此方法来创建 BCSSServiceProvider 的新子类,而无需重写 addService() 以实例化。protected final void触发BeanContextServiceAvailableEvent指示新服务已可用。protected final voidfireServiceAdded(Class<?> serviceClass) 触发BeanContextServiceEvent通知新服务。protected final void触发BeanContextServiceEvent通知服务被撤销。protected final voidfireServiceRevoked(Class<?> serviceClass, boolean revokeNow) 触发BeanContextServiceRevokedEvent指示特定服务不再可用。获取与此BeanContextServicesSupport关联的BeanContextServices。protected static final BeanContextServicesListener获取指定子项的BeanContextServicesListener(如果有)。获取此上下文的当前可用服务。Iterator<?>getCurrentServiceSelectors(Class<?> serviceClass) 通过调用底层 BeanContextServiceProvider 上的 getCurrentServiceSelectors() 获取指定服务的服务相关服务参数(服务选择器)列表。getService(BeanContextChild child, Object requestor, Class<?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) 获得可以委托的服务booleanhasService(Class<?> serviceClass) 有一个服务,可以委托void在构造和反序列化期间由 BeanContextSupport 超类调用以初始化子类瞬态。protected void从 setBeanContext 调用以通知 BeanContextChild 分配从嵌套 BeanContext 获得的资源。protected void从 setBeanContext 调用以通知 BeanContextChild 释放从嵌套 BeanContext 获得的资源。voidreleaseService(BeanContextChild child, Object requestor, Object service) 发布服务void删除 BeanContextServicesListenervoidrevokeService(Class<?> serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) 删除服务voidBeanContextServicesListener 回调,将事件传播到所有当前注册的监听和 BeanContextServices 子级,如果此 BeanContextService 本身尚未实现此服务。voidBeanContextServicesListener 回调,将事件传播到所有当前注册的监听和 BeanContextServices 子级,如果此 BeanContextService 本身尚未实现此服务。在类 java.beans.beancontext.BeanContextSupport 中声明的方法
add, addAll, addBeanContextMembershipListener, avoidingGui, bcsChildren, childDeserializedHook, childJustAddedHook, classEquals, clear, contains, containsAll, containsKey, copyChildren, deserialize, dontUseGui, fireChildrenAdded, fireChildrenRemoved, getBeanContextPeer, getChildBeanContextChild, getChildBeanContextMembershipListener, getChildPropertyChangeListener, getChildSerializable, getChildVetoableChangeListener, getChildVisibility, getLocale, getResource, getResourceAsStream, instantiateChild, isDesignTime, isEmpty, isSerializing, iterator, needsGui, okToUseGui, propertyChange, readChildren, remove, remove, removeAll, removeBeanContextMembershipListener, retainAll, serialize, setDesignTime, setLocale, size, toArray, toArray, validatePendingAdd, validatePendingRemove, vetoableChange, writeChildren在类 java.beans.beancontext.BeanContextChildSupport 中声明的方法
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContext在类 java.lang.Object 中声明的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait在接口 java.beans.beancontext.BeanContext 中声明的方法
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener在接口 java.beans.beancontext.BeanContextChild 中声明的方法
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext在接口 java.util.Collection 中声明的方法
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray在接口 java.beans.DesignMode 中声明的方法
isDesignTime, setDesignTime在接口 java.beans.Visibility 中声明的方法
avoidingGui, dontUseGui, needsGui, okToUseGui
-
字段详细信息
-
services
对protected transient HashMap services字段的所有访问都应在该对象上同步 -
serializable
protected transient int serializable可序列化BeanContextServceProvider的实例数。 -
proxy
代表BeanContextServiceProvider。 -
bcsListeners
BeanContextServicesListener对象列表。
-
-
构造方法详细信息
-
BeanContextServicesSupport
public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dTime, boolean visible) 构造一个 BeanContextServicesSupport 实例
- 参数:
peer- 我们为其提供实现的对等 BeanContext,如果为 null,则此对象是它自己的对等体lcle- 此 BeanContext 的当前locale。dTime- 初始状态,如果处于设计模式则为真,如果是运行时则为假。visible- 初始可见性。
-
BeanContextServicesSupport
使用指定的locale和设计模式创建实例。- 参数:
peer- 我们为其提供实现的对等 BeanContext,如果为 null,则此对象是它自己的对等体lcle- 此 BeanContext 的当前locale。dtime- 初始状态,如果处于设计模式则为真,如果是运行时则为假。
-
BeanContextServicesSupport
使用指定locale创建实例- 参数:
peer- 我们为其提供实现的对等 BeanContext,如果为 null,则此对象是它自己的对等体lcle- 此 BeanContext 的当前locale。
-
BeanContextServicesSupport
创建具有对等体的实例- 参数:
peer- 我们为其提供实现的对等 BeanContext,如果为 null,则此对象是它自己的对等体
-
BeanContextServicesSupport
public BeanContextServicesSupport()创建一个不是另一个对象的委托的实例
-
-
方法详情
-
initialize
public void initialize()在构造和反序列化期间由 BeanContextSupport 超类调用以初始化子类瞬态。子类可以封装此方法,但不应重写它或直接调用它。- 重写:
initialize在类BeanContextSupport中
-
getBeanContextServicesPeer
获取与此BeanContextServicesSupport关联的BeanContextServices。- 返回:
BeanContext的实例此对象正在为其提供实现。
-
createBCSChild
子类可以重写此方法以插入自己的 Child 子类,而不必重写 add() 或其他将子类添加到集合的 Collection 方法。
- 重写:
createBCSChild在类BeanContextSupport中- 参数:
targetChild- 子代创建子代peer- 如果 targetChild 和 peer 由 BeanContextProxy 关联,则为 peer- 返回:
- Child 的特定于子类型的子类,没有重写集合方法
-
createBCSSServiceProvider
protected BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(Class <?> sc, BeanContextServiceProvider bcsp) 子类可以重写此方法来创建 BCSSServiceProvider 的新子类,而无需重写 addService() 以实例化。- 参数:
sc- 类bcsp- 服务提供商- 返回:
- 没有重写 addService() 的服务提供者
-
addBeanContextServicesListener
添加一个 BeanContextServicesListener- 指定者:
addBeanContextServicesListener在接口BeanContextServices中- 参数:
bcsl- 要添加的BeanContextServicesListener- 抛出:
NullPointerException- 如果参数为空
-
removeBeanContextServicesListener
删除 BeanContextServicesListener- 指定者:
removeBeanContextServicesListener在接口BeanContextServices中- 参数:
bcsl- 要从此上下文中删除的BeanContextServicesListener
-
addService
添加服务- 指定者:
addService在接口BeanContextServices中- 参数:
serviceClass- 服务类bcsp- 服务提供商- 返回:
- 如果服务添加成功则为 true,否则为 false
-
addService
protected boolean addService(Class <?> serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) 添加服务- 参数:
serviceClass- 服务类bcsp- 服务提供商fireEvent- 是否应该触发一个事件- 返回:
- 如果服务已成功添加,则为真
-
revokeService
public void revokeService(Class <?> serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) 删除服务- 指定者:
revokeService在接口BeanContextServices中- 参数:
serviceClass- 服务类bcsp- 服务提供商revokeCurrentServicesNow- 是否撤销服务
-
hasService
有一个服务,可以委托- 指定者:
hasService在接口BeanContextServices中- 参数:
serviceClass- 有问题的服务- 返回:
- 如果服务可用则为真
-
getService
public Object getService(BeanContextChild child, Object requestor, Class <?> serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException 获得可以委托的服务- 指定者:
getService在接口BeanContextServices中- 参数:
child- 与此请求关联的BeanContextChildrequestor- 请求服务的对象serviceClass- 请求服务的类serviceSelector- 服务相关参数bcsrl-BeanContextServiceRevokedListener通知服务是否应该在以后被撤销- 返回:
-
根据请求引用此上下文的命名服务或
null - 抛出:
TooManyListenersException- 如果听众太多
-
releaseService
发布服务- 指定者:
releaseService在接口BeanContextServices中- 参数:
child-BeanContextChildrequestor- 请求者service- 服务
-
getCurrentServiceClasses
从接口BeanContextServices复制的描述获取此上下文的当前可用服务。- 指定者:
getCurrentServiceClasses在接口BeanContextServices中- 返回:
- 所有当前注册的服务类的迭代器。
-
getCurrentServiceSelectors
从接口BeanContextServices复制的描述通过调用底层 BeanContextServiceProvider 上的 getCurrentServiceSelectors() 获取指定服务的服务相关服务参数(服务选择器)列表。- 指定者:
getCurrentServiceSelectors在接口BeanContextServices中- 参数:
serviceClass- 指定的服务- 返回:
- 指定服务可用的所有当前可用服务选择器(如果有)的迭代器。
-
serviceAvailable
BeanContextServicesListener 回调,将事件传播到所有当前注册的监听和 BeanContextServices 子级,如果此 BeanContextService 本身尚未实现此服务。子类可以重写或封装此方法以实现它们自己的传播语义。- 指定者:
serviceAvailable在接口BeanContextServicesListener中- 重写:
serviceAvailable在类BeanContextChildSupport中- 参数:
bcssae- 由于服务可用而触发的 BeanContextServiceAvailableEvent
-
serviceRevoked
BeanContextServicesListener 回调,将事件传播到所有当前注册的监听和 BeanContextServices 子级,如果此 BeanContextService 本身尚未实现此服务。子类可以重写或封装此方法以实现它们自己的传播语义。- 指定者:
serviceRevoked在接口BeanContextServiceRevokedListener中- 重写:
serviceRevoked在类BeanContextChildSupport中- 参数:
bcssre-BeanContextServiceRevokedEvent由于服务被撤销而被解雇
-
getChildBeanContextServicesListener
protected static final BeanContextServicesListener getChildBeanContextServicesListener(Object child) 获取指定子项的BeanContextServicesListener(如果有)。- 参数:
child- 指定的孩子- 返回:
- 指定子项的 BeanContextServicesListener(如果有)
-
childJustRemovedHook
在成功删除子项后从超类子项删除操作中调用。与子同步调用。如果该子类是 BeanContextChild,则该子类使用该挂钩立即撤销该子类正在使用的任何服务。子类可以封装此方法以实现它们自己的子类移除副作用。- 重写:
childJustRemovedHook在类BeanContextSupport中- 参数:
child- 孩子bcsc- BCSChild
-
releaseBeanContextResources
protected void releaseBeanContextResources()从 setBeanContext 调用以通知 BeanContextChild 释放从嵌套 BeanContext 获得的资源。此方法撤销从其父级获得的任何服务。子类可以封装这个方法来实现它们自己的语义。 -
initializeBeanContextResources
protected void initializeBeanContextResources()从 setBeanContext 调用以通知 BeanContextChild 分配从嵌套 BeanContext 获得的资源。子类可以封装这个方法来实现它们自己的语义。 -
fireServiceAdded
触发BeanContextServiceEvent通知新服务。- 参数:
serviceClass- 服务类
-
fireServiceAdded
触发BeanContextServiceAvailableEvent指示新服务已可用。- 参数:
bcssae-BeanContextServiceAvailableEvent
-
fireServiceRevoked
触发BeanContextServiceEvent通知服务被撤销。- 参数:
bcsre-BeanContextServiceRevokedEvent
-
fireServiceRevoked
触发BeanContextServiceRevokedEvent指示特定服务不再可用。- 参数:
serviceClass- 服务类revokeNow- 事件是否应该立即撤销
-
bcsPreSerializationHook
在序列化子级之前从 BeanContextSupport writeObject 调用...此类将序列化此处的任何可序列化 BeanContextServiceProvider。子类可以封装此方法以插入必须在子类序列化之前发生的自己的序列化处理- 重写:
bcsPreSerializationHook在类BeanContextSupport中- 参数:
oos- 在序列化期间使用的ObjectOutputStream- 抛出:
IOException- 如果序列化失败
-
bcsPreDeserializationHook
protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException , ClassNotFoundException 在反序列化子级之前从 BeanContextSupport readObject 调用...此类将反序列化之前序列化的任何可序列化 BeanContextServiceProviders,从而使它们在反序列化时可供子级使用。子类可以封装此方法以插入必须在子类序列化之前发生的自己的序列化处理- 重写:
bcsPreDeserializationHook在类BeanContextSupport中- 参数:
ois- 在反序列化期间使用的ObjectInputStream- 抛出:
IOException- 如果反序列化失败ClassNotFoundException- 如果找不到需要的类
-