@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1764") @Immutable public final class Attributes extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Attributes.Builder |
static class |
Attributes.Key<T>
Key for an key-value pair.
|
Modifier and Type | Field and Description |
---|---|
static Attributes |
EMPTY |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Returns true if the given object is also a
Attributes with an equal attribute values. |
<T> T |
get(Attributes.Key<T> key)
Gets the value for the key, or
null if it's not present. |
int |
hashCode()
Returns a hash code for the attributes.
|
Set<Attributes.Key<?>> |
keys()
Returns set of keys stored in container.
|
static Attributes.Builder |
newBuilder()
Create a new builder.
|
static Attributes.Builder |
newBuilder(Attributes base)
Create a new builder that is pre-populated with the content from a given container.
|
String |
toString() |
public static final Attributes EMPTY
@Nullable public <T> T get(Attributes.Key<T> key)
null
if it's not present.public Set<Attributes.Key<?>> keys()
public static Attributes.Builder newBuilder(Attributes base)
public static Attributes.Builder newBuilder()
public boolean equals(Object o)
Attributes
with an equal attribute values.
Note that if a stored values are mutable, it is possible for two objects to be considered equal at one point in time and not equal at another (due to concurrent mutation of attribute values).
equals
in class Object
o
- an object.Attributes
equal attributes.public int hashCode()
Note that if a stored values are mutable, it is possible for two objects to be considered equal at one point in time and not equal at another (due to concurrent mutation of attribute values).