io.vertx.servicediscovery

## Class Record

- java.lang.Object
- - io.vertx.servicediscovery.Record

-     public class Record
      extends Object

  Describes a `service`. The record is the only piece of information shared between consumer and provider. It should contains enough metadata to let consumer find the service they want.
  Author:
    Clement Escoffier

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ENDPOINT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Record()` Creates a new `Record`.
    `Record(JsonObject json)` Creates a new `Record` from its json representation.
    `Record(Record other)` Creates a new `Record` by copying the values from another `Record`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)` Checks whether or not the current object is equal to the given object.
    `JsonObject` | `getLocation()`
    `JsonObject` | `getMetadata()` Gets the metadata attached to the record.
    `String` | `getName()` Gets the name of the service.
    `String` | `getRegistration()` Gets the registration id if any.
    `Status` | `getStatus()` Gets the current status of the service.
    `String` | `getType()` Gets the service type.
    `int` | `hashCode()`
    `boolean` | `match(JsonObject filter)` Checks whether or not the current `Record` matches the filter.
    `Record` | `setLocation(JsonObject location)` Sets the json object describing the location of the service.
    `Record` | `setMetadata(JsonObject metadata)`
    `Record` | `setName(String name)` Sets the name of the service.
    `Record` | `setRegistration(String reg)` Sets the registration id.
    `Record` | `setStatus(Status status)` Sets the status of the service.
    `Record` | `setType(String type)` Sets the type of service.
    `JsonObject` | `toJson()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ENDPOINT

          public static final String ENDPOINT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Record

          public Record()

      Creates a new `Record`.

    - #### Record

          public Record(JsonObject json)

      Creates a new `Record` from its json representation.
      Parameters:
        `json` - the json object

    - #### Record

          public Record(Record other)

      Creates a new `Record` by copying the values from another `Record`.
      Parameters:
        `other` - the record to copy

  - ### Method Detail

    - #### toJson

          public JsonObject toJson()

      Returns:
        the JSON representation of the current `Record`.

    - #### getLocation

          public JsonObject getLocation()

      Returns:
        the json object describing the location of the service. By convention, this json object should contain the `ENDPOINT` entry.

    - #### setLocation

          public Record setLocation(JsonObject location)

      Sets the json object describing the location of the service. By convention, this json object should contain the `ENDPOINT` entry.
      Parameters:
        `location` - the location
      Returns:
        the current `Record`

    - #### getMetadata

          public JsonObject getMetadata()

      Gets the metadata attached to the record.
      Returns:
        the metadata, cannot be `null`.

    - #### setMetadata

          public Record setMetadata(JsonObject metadata)

    - #### getName

          public String getName()

      Gets the name of the service. It can reflect the service name of the name of the provider.
      Returns:
        the name

    - #### setName

          public Record setName(String name)

      Sets the name of the service. It can reflect the service name of the name of the provider.
      Parameters:
        `name` - the name
      Returns:
        the current `Record`

    - #### getStatus

          public Status getStatus()

      Gets the current status of the service.
      Returns:
        the status.

    - #### setStatus

          public Record setStatus(Status status)

      Sets the status of the service. When published, the status is set to`Status.UP`. When withdrawn, the status is set to `Status.DOWN`.
      Parameters:
        `status` - the status, must not be `null`
      Returns:
        the current `Record`

    - #### setRegistration

          public Record setRegistration(String reg)

      Sets the registration id. This method is called when the service is published.
      Parameters:
        `reg` - the registration id
      Returns:
        the current `Record`

    - #### getRegistration

          public String getRegistration()

      Gets the registration id if any. Getting a `null` result means that the record has not been published.
      Returns:
        the registration id.

    - #### getType

          public String getType()

      Gets the service type. The type represents what kind of "resource" is represented by this record. For example it can be "http-endpoint", "database", "message-source"... The set of types is extensible.

      The type defines how the the service object is retrieved, and also manages the binding. Some records may have no type and let the consumer manage how the service is used.

      Returns:
        the type

    - #### setType

          public Record setType(String type)

      Sets the type of service.
      Parameters:
        `type` - the type
      Returns:
        the current `Record`

    - #### match

          public boolean match(JsonObject filter)

      Checks whether or not the current `Record` matches the filter.
      Parameters:
        `filter` - the filter
      Returns:
        whether or not the record matches the filter

    - #### equals

          public boolean equals(Object o)

      Checks whether or not the current object is equal to the given object.
      Overrides:
        `equals` in class `Object`
      Parameters:
        `o` - the object to compare to this service record
      Returns:
        `true` when equal, `false` otherwise

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`
      Returns:
        the hash code of the current service record

Copyright © 2019 Eclipse. All rights reserved.