@InterfaceAudience.Public @InterfaceStability.Evolving public class ServiceRecord extends Object implements Cloneable
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 and Description |
---|
ServiceRecord()
Create a service record with no ID, description or registration time.
|
ServiceRecord(ServiceRecord that)
Deep cloning constructor
|
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() |
public static final String RECORD_TYPE
public String type
RECORD_TYPE
public String description
public ServiceRecord()
public ServiceRecord(ServiceRecord that)
that
- service record sourcepublic void addExternalEndpoint(Endpoint endpoint)
endpoint
- endpoint to setpublic void addInternalEndpoint(Endpoint endpoint)
endpoint
- endpoint to setpublic Endpoint getInternalEndpoint(String api)
api
- APIpublic Endpoint getExternalEndpoint(String api)
api
- APIpublic void set(String key, Object value)
attributes
mapkey
- attribute namevalue
- attribute value.public Map<String,String> attributes()
public String get(String key)
key
- key to look uppublic String get(String key, String defVal)
key
- key to look updefVal
- default valuedefval
if the value was not presentprotected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright © 2023 Apache Software Foundation. All rights reserved.