Class Attributes
Annotation semantics
As a convention, annotations such as Grpc.TransportAttr is defined to associate
attribute Attributes.Keys and their propagation paths. The annotation may be applied to a
Key definition field, a method that returns Attributes, or a variable of type Attributes, to indicate that the annotated Attributes objects may contain the annotated
Key.
Javadoc users may click "USE" on the navigation bars of the annotation's javadoc page to view references of such annotation.
- Since:
- 1.13.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe helper class to build an Attributes instance.static final classKey for an key-value pair. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the given object is also aAttributeswith an equal attribute values.<T> Tget(Attributes.Key<T> key) Gets the value for the key, ornullif it's not present.inthashCode()Returns a hash code for the attributes.Set<Attributes.Key<?>>keys()Deprecated.This method is being considered for removal, if you feel this method is needed please reach out on this Github issue: grpc-java/issues/1764.static Attributes.BuilderCreate a new builder.static Attributes.BuildernewBuilder(Attributes base) Deprecated.UsetoBuilder()on theAttributesinstance instead.Creates a new builder that is pre-populated with the content of this container.toString()
-
Field Details
-
EMPTY
-
-
Method Details
-
get
Gets the value for the key, ornullif it's not present. -
keys
Deprecated.This method is being considered for removal, if you feel this method is needed please reach out on this Github issue: grpc-java/issues/1764.Returns set of keys stored in container.- Returns:
- Set of Key objects.
-
newBuilder
Deprecated.UsetoBuilder()on theAttributesinstance instead. This method will be removed in the future.Create a new builder that is pre-populated with the content from a given container. -
newBuilder
Create a new builder. -
toBuilder
Creates a new builder that is pre-populated with the content of this container.- Returns:
- a new builder.
-
toString
-
equals
Returns true if the given object is also aAttributeswith 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).
This method is not implemented efficiently and is meant for testing.
- Overrides:
equalsin classObject- Parameters:
o- an object.- Returns:
- true if the given object is a
Attributesequal attributes.
-
hashCode
public int hashCode()Returns a hash code for the attributes.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).
-