Class ServiceRecord
java.lang.Object
org.apache.hadoop.registry.client.types.ServiceRecord
- All Implemented Interfaces:
Cloneable
JSON-marshallable description of a single component.
It supports the deserialization of unknown attributes, but does
not support their creation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionDescription stringList of endpoints intended for use to external callersList of endpoints for use within an application.static final StringA type string which MUST be in the serialized json.The type field. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a service record with no ID, description or registration time.ServiceRecord(ServiceRecord that) Deep cloning constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalEndpoint(Endpoint endpoint) Add an external endpointvoidaddInternalEndpoint(Endpoint endpoint) Add an internal endpointThe map of "other" attributes set when parsing.protected Objectclone()Shallow clone: all endpoints will be shared across instancesbooleanGet the "other" attribute with a specific keyGet the "other" attribute with a specific key.Look up an external endpointLook up an internal endpointinthashCode()voidHandle unknown attributes by storing them in theattributesmaptoString()
-
Field Details
-
RECORD_TYPE
A type string which MUST be in the serialized json. This permits fast discarding of invalid entries- See Also:
-
type
The type field. This must be the stringRECORD_TYPE -
description
Description string -
external
List of endpoints intended for use to external callers -
internal
List of endpoints for use within an application.
-
-
Constructor Details
-
ServiceRecord
public ServiceRecord()Create a service record with no ID, description or registration time. Endpoint lists are set to empty lists. -
ServiceRecord
Deep cloning constructor- Parameters:
that- service record source
-
-
Method Details
-
addExternalEndpoint
Add an external endpoint- Parameters:
endpoint- endpoint to set
-
addInternalEndpoint
Add an internal endpoint- Parameters:
endpoint- endpoint to set
-
getInternalEndpoint
Look up an internal endpoint- Parameters:
api- API- Returns:
- the endpoint or null if there was no match
-
getExternalEndpoint
Look up an external endpoint- Parameters:
api- API- Returns:
- the endpoint or null if there was no match
-
set
Handle unknown attributes by storing them in theattributesmap- Parameters:
key- attribute namevalue- attribute value.
-
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
Get the "other" attribute with a specific key- Parameters:
key- key to look up- Returns:
- the value or null
-
get
Get the "other" attribute with a specific key.- Parameters:
key- key to look updefVal- default value- Returns:
- the value as a string,
or
defvalif the value was not present
-
toString
-
clone
Shallow clone: all endpoints will be shared across instances- Overrides:
clonein classObject- Returns:
- a clone of the instance
- Throws:
CloneNotSupportedException
-
hashCode
public int hashCode() -
equals
-