public class BeanContextServicesSupport extends BeanContextSupport implements BeanContextServices
这个助手类提供java.beans.beancontext.BeanContextServices接口的实用程序实现。
由于此类直接实现了BeanContextServices接口,所以该类可以通过对该实现进行子类化,也可以通过BeanContextProxy接口从另一个实例委派这个类来实现。
Modifier and Type | Class and Description |
---|---|
protected class |
BeanContextServicesSupport.BCSSChild |
protected class |
BeanContextServicesSupport.BCSSProxyServiceProvider |
protected static class |
BeanContextServicesSupport.BCSSServiceProvider
子类可以将此嵌套类子类化为每个BeanContextServicesProvider添加行为。
|
BeanContextSupport.BCSChild, BeanContextSupport.BCSIterator
Modifier and Type | Field and Description |
---|---|
protected ArrayList |
bcsListeners
BeanContextServicesListener对象列表。
|
protected BeanContextServicesSupport.BCSSProxyServiceProvider |
proxy
代表
BeanContextServiceProvider 。
|
protected int |
serializable
可串行化的数量
BeanContextServceProvider 。
|
protected HashMap |
services
protected transient HashMap services 字段的所有访问应该在该对象上同步
|
bcmListeners, children, designTime, locale, okToUseGui
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
globalHierarchyLock
PROPERTYNAME
Constructor and Description |
---|
BeanContextServicesSupport()
创建一个不是另一个对象的委托的实例
|
BeanContextServicesSupport(BeanContextServices peer)
与对等体创建一个实例
|
BeanContextServicesSupport(BeanContextServices peer, Locale lcle)
使用指定的区域设置创建一个实例
|
BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dtime)
使用指定的区域设置和设计模式创建一个实例。
|
BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dTime, boolean visible)
构造一个BeanContextServicesSupport实例
|
Modifier and Type | Method and Description |
---|---|
void |
addBeanContextServicesListener(BeanContextServicesListener bcsl)
添加一个BeanContextServicesListener
|
boolean |
addService(类 serviceClass, BeanContextServiceProvider bcsp)
添加服务
|
protected boolean |
addService(类 serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent)
添加服务
|
protected void |
bcsPreDeserializationHook(ObjectInputStream ois)
从BeanContextSupport readObject中调用它反序列化子对象...
|
protected void |
bcsPreSerializationHook(ObjectOutputStream oos)
从BeanContextSupport中调用writeObject,然后序列化子对象...
|
protected void |
childJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc)
在孩子被成功删除之后从超类儿童删除操作中调用。
|
protected BeanContextSupport.BCSChild |
createBCSChild(Object targetChild, Object peer)
子类可以覆盖这个方法来插入他们自己的Child子类,而不必重写add()或者添加子集的其他Collection方法。
|
protected BeanContextServicesSupport.BCSSServiceProvider |
createBCSSServiceProvider(类 sc, BeanContextServiceProvider bcsp)
子类可以覆盖此方法来创建BCSSServiceProvider的新子类,而不必重写addService()以便实例化。
|
protected void |
fireServiceAdded(BeanContextServiceAvailableEvent bcssae)
触发一个
BeanContextServiceAvailableEvent ,表示新的服务已经可用。
|
protected void |
fireServiceAdded(类 serviceClass)
发射一枚
BeanContextServiceEvent通知新的服务。
|
protected void |
fireServiceRevoked(BeanContextServiceRevokedEvent bcsre)
发出
BeanContextServiceEvent通知正在撤销的服务。
|
protected void |
fireServiceRevoked(类 serviceClass, boolean revokeNow)
触发一个
BeanContextServiceRevokedEvent ,表示某个服务不再可用。
|
BeanContextServices |
getBeanContextServicesPeer()
获取与此
BeanContextServicesSupport相关的
BeanContextServices。
|
protected static BeanContextServicesListener |
getChildBeanContextServicesListener(Object child)
获取指定
子项的BeanContextServicesListener (如果有)。
|
Iterator |
getCurrentServiceClasses()
获取此上下文的当前可用服务。
|
Iterator |
getCurrentServiceSelectors(类 serviceClass)
通过调用底层BeanContextServiceProvider上的getCurrentServiceSelectors(),获取指定服务的服务相关服务参数(服务选择器)列表。
|
Object |
getService(BeanContextChild child, Object requestor, 类 serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl)
获得可能委托的服务
|
boolean |
hasService(类 serviceClass)
有一个可以委派的服务
|
void |
initialize()
在构造和反序列化期间由BeanContextSupport超类调用以初始化子类暂态。
|
protected void |
initializeBeanContextResources()
从setBeanContext调用通知一个BeanContextChild来分配从嵌套BeanContext获取的资源。
|
protected void |
releaseBeanContextResources()
从setBeanContext调用,以通知BeanContextChild释放从嵌套BeanContext获取的资源。
|
void |
releaseService(BeanContextChild child, Object requestor, Object service)
发布服务
|
void |
removeBeanContextServicesListener(BeanContextServicesListener bcsl)
删除一个BeanContextServicesListener
|
void |
revokeService(类 serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow)
删除服务
|
void |
serviceAvailable(BeanContextServiceAvailableEvent bcssae)
BeanContextServicesListener回调,将事件传播到所有当前注册的监听器和BeanContextServices子节点,如果此BeanContextService尚未实现此服务本身。
|
void |
serviceRevoked(BeanContextServiceRevokedEvent bcssre)
BeanContextServicesListener回调,将事件传播到所有当前注册的监听器和BeanContextServices子节点,如果此BeanContextService尚未实现此服务本身。
|
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
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, isDelegated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, validatePendingSetBeanContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBeanContextMembershipListener, getResource, getResourceAsStream, instantiateChild, removeBeanContextMembershipListener
addPropertyChangeListener, addVetoableChangeListener, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
isDesignTime, setDesignTime
avoidingGui, dontUseGui, needsGui, okToUseGui
protected transient HashMap services
protected transient HashMap services
字段的所有访问
protected transient int serializable
protected transient BeanContextServicesSupport.BCSSProxyServiceProvider proxy
protected transient ArrayList bcsListeners
public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dTime, boolean visible)
构造一个BeanContextServicesSupport实例
peer
- 对等BeanContext我们提供了一个实现,如果null这个对象是它自己的对等
lcle
- 此BeanContext的当前区域设置。
dTime
- 初始状态,如果在设计模式下为true,则运行时为false。
visible
- 初始可见性。
public BeanContextServicesSupport(BeanContextServices peer, Locale lcle, boolean dtime)
peer
- 对等BeanContext我们提供了一个实现,如果null,这个对象是它自己的对等体
lcle
- 此BeanContext的当前区域设置。
dtime
- 初始状态,如果在设计模式下为真,如果运行时为false。
public BeanContextServicesSupport(BeanContextServices peer, Locale lcle)
peer
- 对等BeanContext,我们提供一个实现,如果null,这个对象是它自己的对等
lcle
- 此BeanContext的当前区域设置。
public BeanContextServicesSupport(BeanContextServices peer)
peer
- 对等BeanContext我们提供了一个实现,如果null这个对象是它自己的对等
public BeanContextServicesSupport()
public void initialize()
public BeanContextServices getBeanContextServicesPeer()
protected BeanContextSupport.BCSChild createBCSChild(Object targetChild, Object peer)
子类可以覆盖这个方法来插入他们自己的Child子类,而不必重写add()或者添加子集的其他Collection方法。
createBCSChild
在
BeanContextSupport
targetChild
- 代表孩子创建的孩子
peer
- 对等体如果targetChild和对等体是由BeanContextProxy相关的
protected BeanContextServicesSupport.BCSSServiceProvider createBCSSServiceProvider(类 sc, BeanContextServiceProvider bcsp)
sc
- 该类
bcsp
- 服务提供商
public void addBeanContextServicesListener(BeanContextServicesListener bcsl)
addBeanContextServicesListener
中的
BeanContextServices
bcsl
- 要添加的
BeanContextServicesListener
NullPointerException
- 如果参数为空
public void removeBeanContextServicesListener(BeanContextServicesListener bcsl)
removeBeanContextServicesListener
在界面
BeanContextServices
bcsl
- 要从此上下文中删除的
BeanContextServicesListener
public boolean addService(类 serviceClass, BeanContextServiceProvider bcsp)
addService
在界面
BeanContextServices
serviceClass
- 服务类
bcsp
- 服务提供商
protected boolean addService(类 serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent)
serviceClass
- 服务类
bcsp
- 服务提供商
fireEvent
- 是否应该触发事件
public void revokeService(类 serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow)
revokeService
在接口
BeanContextServices
serviceClass
- 服务类
bcsp
- 服务提供商
revokeCurrentServicesNow
- 是否撤销服务
public boolean hasService(类 serviceClass)
hasService
在接口
BeanContextServices
serviceClass
- 有关服务
public Object getService(BeanContextChild child, Object requestor, 类 serviceClass, Object serviceSelector, BeanContextServiceRevokedListener bcsrl) throws TooManyListenersException
getService
在界面
BeanContextServices
child
- 与此请求相关
BeanContextChild
BeanContextChild
requestor
- 请求服务的对象
serviceClass
- 所请求的服务的类
serviceSelector
- 服务相关参数
bcsrl
-
BeanContextServiceRevokedListener
以通知服务是否应该被撤销
null
TooManyListenersException
- 如果有太多的听众
public void releaseService(BeanContextChild child, Object requestor, Object service)
releaseService
在界面
BeanContextServices
child
-
BeanContextChild
requestor
- 请求者
service
- 服务
public Iterator getCurrentServiceClasses()
BeanContextServices
复制
getCurrentServiceClasses
中的
BeanContextServices
public Iterator getCurrentServiceSelectors(类 serviceClass)
BeanContextServices
getCurrentServiceSelectors
中的
BeanContextServices
serviceClass
- 指定的服务
public void serviceAvailable(BeanContextServiceAvailableEvent bcssae)
serviceAvailable
在接口
BeanContextServicesListener
serviceAvailable
在
BeanContextChildSupport
bcssae
- 由于服务变得可用,BeanContextServiceAvailableEvent被触发
public void serviceRevoked(BeanContextServiceRevokedEvent bcssre)
serviceRevoked
在接口
BeanContextServiceRevokedListener
serviceRevoked
在
BeanContextChildSupport
bcssre
-
BeanContextServiceRevokedEvent
由于服务被撤销而被触发
protected static final BeanContextServicesListener getChildBeanContextServicesListener(Object child)
child
- 指定的小孩
protected void childJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc)
childJustRemovedHook
在
BeanContextSupport
child
- 小孩
bcsc
- BCSChild
protected void releaseBeanContextResources()
protected void initializeBeanContextResources()
protected final void fireServiceAdded(类 serviceClass)
serviceClass
- 服务类
protected final void fireServiceAdded(BeanContextServiceAvailableEvent bcssae)
bcssae
-
BeanContextServiceAvailableEvent
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent bcsre)
bcsre
-
BeanContextServiceRevokedEvent
protected final void fireServiceRevoked(类 serviceClass, boolean revokeNow)
serviceClass
- 服务类
revokeNow
- 现在是否应该撤消事件
protected void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException
bcsPreSerializationHook
在
BeanContextSupport
oos
-
ObjectOutputStream
期间使用的ObjectOutputStream
IOException
- 如果序列化失败
protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException
bcsPreDeserializationHook
在
BeanContextSupport
类
ois
- 反
ObjectInputStream
期间使用的ObjectInputStream
IOException
- 如果反序列化失败
ClassNotFoundException
- if needed classes are not found
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.