java.lang.Object | +--java.beans.beancontext.BeanContextServiceProvider
java.util.Iterator | getCurrentServiceSelectors(java.beans.beancontext.BeanContextServices services, java.lang.Class serviceClass) Get a list of valid service selectors for the specified service class. |
java.lang.Object | getService(java.beans.beancontext.BeanContextServices services, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector) Get a service. |
void | releaseService(java.beans.beancontext.BeanContextServices services, java.lang.Object requestor, java.lang.Object service) Release the service. |
public Iterator getCurrentServiceSelectors(java.beans.beancontext.BeanContextServices services, java.lang.Class serviceClass)
BeanContextServices.getCurrentServiceSelectors()
.
If the specified service class does not have a finite number of
valid service selectors, it should return null
.
If it takes a general Integer
parameter, for
example, you may as well return null
or the poor
soul who called this method will be iterating all day.
If it has no valid service selectors, it should still return an empty
Iterator
.
services
- the BeanContextServices
that wants
to get the service selectors.serviceClass
- the service class to get selectors for.null
.public Object getService(java.beans.beancontext.BeanContextServices services, java.lang.Object requestor, java.lang.Class serviceClass, java.lang.Object serviceSelector)
BeanContextServices.getService().
If the requested service class is not available, or if this
BeanContextServiceProvider
chooses not honor the
request for some reason, then this method will return
null
.
This method may throw unchecked exceptions, so watch out.
services
- the BeanContextServices
that wants
to get the service.requestor
- the actual requestor of the service.serviceClass
- the Class
of the service being
requested.serviceSelector
- a parameter to customize the service
returned with.serviceClass
(such that
instanceof
serviceClass is true), or
null
.public void releaseService(java.beans.beancontext.BeanContextServices services, java.lang.Object requestor, java.lang.Object service)
Called by BeanContextServices.releaseService()
.
Most BeanContextServiceProvider
s won't have to do
anything here.
services
- the BeanContextServices
that wants
to release the service.requestor
- the original requestor of the service.service
- the service to relinquish
It is the
BeanContextServiceProvider
's responsibility to register itself with whateverBeanContextServices
object it wishes to provide services through using theaddService()
method.If for some reason it can no longer provide services for a particular class, this class must invoke
BeanContextServices.revokeService(serviceClass,this,true)
for all the places it has registered the service.