@InterfaceAudience.Public @InterfaceStability.Evolving public final class Endpoint extends Object implements Cloneable
Every endpoint can have more than one address entry, such as a list of URLs to a replicated service, or a (hostname, port) pair. Each of these address entries is represented as a string list, as that is the only reliably marshallable form of a tuple JSON can represent.
Modifier and Type | Field and Description |
---|---|
List<Map<String,String>> |
addresses
a list of address tuples —tuples whose format depends on the address type
|
String |
addressType
Type of address.
|
String |
api
API implemented at the end of the binding
|
String |
protocolType
Protocol type.
|
Constructor and Description |
---|
Endpoint()
Create an empty instance.
|
Endpoint(Endpoint that)
Create an endpoint from another endpoint.
|
Endpoint(String api,
String addressType,
String protocolType)
Build an endpoint with an empty address list
|
Endpoint(String api,
String addressType,
String protocolType,
List<Map<String,String>> addrs)
Build an endpoint with a list of addresses
|
Endpoint(String api,
String addressType,
String protocolType,
Map<String,String>... addrs)
Build an endpoint with a list of addresses
|
Endpoint(String api,
String addressType,
String protocolType,
Map<String,String> addr)
Build an endpoint with a single address entry.
|
Endpoint(String api,
String protocolType,
URI... uris)
Build an endpoint from a list of URIs; each URI
is ASCII-encoded and added to the list of addresses.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Shallow clone: the lists of addresses are shared
|
String |
toString() |
void |
validate()
Validate the record by checking for null fields and other invalid
conditions
|
public String api
public String addressType
AddressTypes
public String protocolType
ProtocolTypes
public Endpoint()
public Endpoint(Endpoint that)
that
- the endpoint to copy frompublic Endpoint(String api, String addressType, String protocolType, List<Map<String,String>> addrs)
api
- API nameaddressType
- address typeprotocolType
- protocol typeaddrs
- addressespublic Endpoint(String api, String addressType, String protocolType)
api
- API nameaddressType
- address typeprotocolType
- protocol typepublic Endpoint(String api, String addressType, String protocolType, Map<String,String> addr)
This constructor is superfluous given the varags constructor is equivalent for a single element argument. However, type-erasure in java generics causes javac to warn about unchecked generic array creation. This constructor, which represents the common "one address" case, does not generate compile-time warnings.
api
- API nameaddressType
- address typeprotocolType
- protocol typeaddr
- address. May be null —in which case it is not addedpublic Endpoint(String api, String addressType, String protocolType, Map<String,String>... addrs)
api
- API nameaddressType
- address typeprotocolType
- protocol typeaddrs
- addresses. Null elements will be skippedpublic void validate()
NullPointerException
- if a field is null when it
MUST be set.RuntimeException
- on invalid entriespublic Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Copyright © 2024 Apache Software Foundation. All rights reserved.