public class WhiteboardHelper<T>
extends org.osgi.util.tracker.ServiceTracker
Modifier and Type | Class and Description |
---|---|
static interface |
WhiteboardHelper.Visitor<T>
To be implemented by the class that wants to obtain a reference to a
certain service.
|
Constructor and Description |
---|
WhiteboardHelper(org.osgi.framework.BundleContext aContext,
Class<T> aServiceClass)
Creates a new WhiteboardHelper instance.
|
WhiteboardHelper(org.osgi.framework.BundleContext aContext,
org.osgi.framework.Filter aFilter)
Creates a new WhiteboardHelper instance.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(WhiteboardHelper.Visitor<? super T> aVisitor)
Called to invoke the given
WhiteboardHelper.Visitor for each found service. |
void |
acceptFirst(WhiteboardHelper.Visitor<? super T> aVisitor)
Called to invoke the given
WhiteboardHelper.Visitor for the first found service. |
T |
getService() |
public WhiteboardHelper(org.osgi.framework.BundleContext aContext, Class<T> aServiceClass)
aContext
- the bundle context to use;aServiceClass
- the class of the service we should track, cannot be
null
.public WhiteboardHelper(org.osgi.framework.BundleContext aContext, org.osgi.framework.Filter aFilter)
aContext
- the bundle context to use;aFilter
- the filter to use while filtering on the services, cannot be
null
;public final void accept(WhiteboardHelper.Visitor<? super T> aVisitor)
WhiteboardHelper.Visitor
for each found service.aVisitor
- the visitor to call for each found service, cannot be
null
.IllegalArgumentException
- in case the given visitor was null
.public final void acceptFirst(WhiteboardHelper.Visitor<? super T> aVisitor)
WhiteboardHelper.Visitor
for the first found service.aVisitor
- the visitor to call for the first found service, cannot be
null
.IllegalArgumentException
- in case the given visitor was null
.public T getService()
getService
in class org.osgi.util.tracker.ServiceTracker
Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.