public interface ServiceReference extends AutoCloseable
ServiceReference
managing the binding with the chosen
service provider.
The reference lets the consumer:
* access the service (via a proxy or a client) with the get()
method
* release the reference - so the binding between the consumer and the provider is removed
Modifier and Type | Method and Description |
---|---|
<T> T |
cached()
Gets the service object if already retrieved.
|
<X> X |
cachedAs(Class<X> x)
Gets the service object if already retrieved.
|
<T> T |
get()
Gets the object to access the service.
|
<X> X |
getAs(Class<X> x)
Gets the object to access the service.
|
boolean |
isHolding(Object object)
Checks whether or not the service reference has the given service object.
|
Record |
record() |
void |
release()
Releases the reference.
|
close
Record record()
<T> T get()
getAs(Class)
to retrieve the polyglot instance of the object or another facet..<X> X getAs(Class<X> x)
X
- the type of objectx
- the type of object<X> X cachedAs(Class<X> x)
cached()
, this method return the warpped object to the desired (given) type.X
- the type of objectx
- the type of objectnull
if not yet retrieved<T> T cached()
null
if not yet retrievedvoid release()
boolean isHolding(Object object)
object
- the service object, must not be null
true
if the service reference service object is equal to the given object, false
otherwise.Copyright © 2023 Eclipse. All rights reserved.