vertx / io.vertx.rxjava.servicediscovery / ServiceReference

# ServiceReference

`open class ServiceReference`

Once a consumer has chosen a service, it builds a io.vertx.rxjava.servicediscovery.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 `io.vertx.rxjava.servicediscovery.ServiceReference#get` method * release the reference - so the binding between the consumer and the provider is removed

NOTE: This class has been automatically generated from the io.vertx.servicediscovery.ServiceReference non RX-ified interface using Vert.x codegen.

### Constructors

<init> | `ServiceReference(delegate: ServiceReference)`

### Properties

__TYPE_ARG | `static val __TYPE_ARG: TypeArg<ServiceReference>`

### Functions

cached | `open fun <T : Any> cached(): T` Gets the service object if already retrieved. It won't try to acquire the service object if not retrieved yet.
cachedAs | `open fun <X : Any> cachedAs(x: Class<X>): X` Gets the service object if already retrieved. It won't try to acquire the service object if not retrieved yet. Unlike `io.vertx.rxjava.servicediscovery.ServiceReference#cached`, this method return the warpped object to the desired (given) type.
equals | `open fun equals(other: Any?): Boolean`
get | `open fun <T : Any> get(): T` Gets the object to access the service. It can be a proxy, a client or whatever object. The type depends on the service type and the server itself. This method returns the Java version and primary facet of the object, use `io.vertx.rxjava.servicediscovery.ServiceReference#getAs` to retrieve the polyglot instance of the object or another facet..
getAs | `open fun <X : Any> getAs(x: Class<X>): X` Gets the object to access the service. It can be a proxy, a client or whatever object. The type depends on the service type and the server itself. This method wraps the service object into the desired type.
getDelegate | `open fun getDelegate(): ServiceReference`
hashCode | `open fun hashCode(): Int`
isHolding | `open fun isHolding(object: Any): Boolean` Checks whether or not the service reference has the given service object.
newInstance | `open static fun newInstance(arg: ServiceReference): ServiceReference`
record | `open fun record(): Record`
release | `open fun release(): Unit` Releases the reference. Once released, the consumer must not use the reference anymore. This method must be idempotent and defensive, as multiple call may happen.
toString | `open fun toString(): String`