org.apache.hadoop.registry.client.types

## Class ServiceRecord

- java.lang.Object
- - org.apache.hadoop.registry.client.types.ServiceRecord

- All Implemented Interfaces:
    Cloneable

      @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class ServiceRecord
      extends Object
      implements Cloneable

  JSON-marshallable description of a single component. It supports the deserialization of unknown attributes, but does not support their creation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `String` | `description` Description string
    `List<Endpoint>` | `external` List of endpoints intended for use to external callers
    `List<Endpoint>` | `internal` List of endpoints for use within an application.
    `static String` | `RECORD_TYPE` A type string which MUST be in the serialized json.
    `String` | `type` The type field.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceRecord()` Create a service record with no ID, description or registration time.
    `ServiceRecord(ServiceRecord that)` Deep cloning constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addExternalEndpoint(Endpoint endpoint)` Add an external endpoint
    `void` | `addInternalEndpoint(Endpoint endpoint)` Add an internal endpoint
    `Map<String,String>` | `attributes()` The map of "other" attributes set when parsing.
    `protected Object` | `clone()` Shallow clone: all endpoints will be shared across instances
    `boolean` | `equals(Object obj)`
    `String` | `get(String key)` Get the "other" attribute with a specific key
    `String` | `get(String key, String defVal)` Get the "other" attribute with a specific key.
    `Endpoint` | `getExternalEndpoint(String api)` Look up an external endpoint
    `Endpoint` | `getInternalEndpoint(String api)` Look up an internal endpoint
    `int` | `hashCode()`
    `void` | `set(String key, Object value)` Handle unknown attributes by storing them in the `attributes` map
    `String` | `toString()`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### RECORD_TYPE

          public static final String RECORD_TYPE

      A type string which MUST be in the serialized json. This permits fast discarding of invalid entries
      See Also:
        Constant Field Values

    - #### type

          public String type

      The type field. This must be the string `RECORD_TYPE`

    - #### description

          public String description

      Description string

    - #### external

          public List<Endpoint> external

      List of endpoints intended for use to external callers

    - #### internal

          public List<Endpoint> internal

      List of endpoints for use within an application.

  - ### Constructor Detail

    - #### ServiceRecord

          public ServiceRecord()

      Create a service record with no ID, description or registration time. Endpoint lists are set to empty lists.

    - #### ServiceRecord

          public ServiceRecord(ServiceRecord that)

      Deep cloning constructor
      Parameters:
        `that` - service record source

  - ### Method Detail

    - #### addExternalEndpoint

          public void addExternalEndpoint(Endpoint endpoint)

      Add an external endpoint
      Parameters:
        `endpoint` - endpoint to set

    - #### addInternalEndpoint

          public void addInternalEndpoint(Endpoint endpoint)

      Add an internal endpoint
      Parameters:
        `endpoint` - endpoint to set

    - #### getInternalEndpoint

          public Endpoint getInternalEndpoint(String api)

      Look up an internal endpoint
      Parameters:
        `api` - API
      Returns:
        the endpoint or null if there was no match

    - #### getExternalEndpoint

          public Endpoint getExternalEndpoint(String api)

      Look up an external endpoint
      Parameters:
        `api` - API
      Returns:
        the endpoint or null if there was no match

    - #### set

          public void set(String key,
                          Object value)

      Handle unknown attributes by storing them in the `attributes` map
      Parameters:
        `key` - attribute name
        `value` - attribute value.

    - #### attributes

          public Map<String,String> attributes()

      The map of "other" attributes set when parsing. These are not included in the JSON value of this record when it is generated.
      Returns:
        a map of any unknown attributes in the deserialized JSON.

    - #### get

          public String get(String key)

      Get the "other" attribute with a specific key
      Parameters:
        `key` - key to look up
      Returns:
        the value or null

    - #### get

          public String get(String key,
                            String defVal)

      Get the "other" attribute with a specific key.
      Parameters:
        `key` - key to look up
        `defVal` - default value
      Returns:
        the value as a string, or `defval` if the value was not present

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### clone

          protected Object clone()
                          throws CloneNotSupportedException

      Shallow clone: all endpoints will be shared across instances
      Overrides:
        `clone` in class `Object`
      Returns:
        a clone of the instance
      Throws:
        `CloneNotSupportedException`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.