- All Known Subinterfaces:
GrpcInboundRequestMetadata
,GrpcInboundResponseMetadata
,GrpcInboundResponseTrailersMetadata
,GrpcOutboundMetadata<A>
,GrpcOutboundRequestMetadata
,GrpcOutboundResponseMetadata
,GrpcOutboundResponseTrailersMetadata
Represents immutable inbound gRPC metadata.
- Since:
- 1.9
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(CharSequence name) Determines whether a metadata with the specified name is present.boolean
contains
(CharSequence name, CharSequence value) Determines whether a metadata with the specified name and value is present.boolean
containsBinary
(CharSequence name) Determines whether a binary metadata with the specified name is present.<T extends com.google.protobuf.MessageLite>
booleancontainsBinary
(CharSequence name, T value) Determines whether a binary metadata with the specified name and value is present.get
(CharSequence name) Returns the value of the metadata with the specified name.getAll
(CharSequence name) Returns the values of all metadata with the specified name.<T extends com.google.protobuf.MessageLite>
List<T> getAllBinary
(CharSequence name, T defaultMessageInstance) Returns the values of all binary metadata with the specified name.<T extends com.google.protobuf.MessageLite>
Optional<T> getBinary
(CharSequence name, T defaultMessageInstance) Returns the value of the binary metadata with the specified name.Returns the names of the binary metadata (*-bin
) specified in the gRPC metadata.getNames()
Returns the names of the metadata specified in the gRPC metadata.
-
Method Details
-
getNames
Returns the names of the metadata specified in the gRPC metadata.
Binary metadata are excluded from the resulting list.
- Returns:
- the plain metadata names
-
contains
Determines whether a metadata with the specified name is present.
- Parameters:
name
- a metadata name- Returns:
- true if a metadata is present, false otherwise
-
contains
Determines whether a metadata with the specified name and value is present.
- Parameters:
name
- a metadata namevalue
- a metadata value- Returns:
- true if a metadata is present, false otherwise
-
get
Returns the value of the metadata with the specified name.
If there are multiple metadata with the same name, the first one is returned.
- Parameters:
name
- a metadata name- Returns:
- an optional returning the value of the metadata or an empty optional if there's no metadata with the specified name
-
getAll
Returns the values of all metadata with the specified name.
- Parameters:
name
- a metadata name- Returns:
- a list of metadata values or an empty list if there's no metadata with the specified name
-
getBinaryNames
Returns the names of the binary metadata (
*-bin
) specified in the gRPC metadata.Plain metadata are excluded from the resulting list which contains names without the binary name suffix
-bin
.- Returns:
- the binary metadata names
-
containsBinary
Determines whether a binary metadata with the specified name is present.
- Parameters:
name
- a binary metadata name without the binary name suffix-bin
- Returns:
- true if a binary metadata is present, false otherwise
-
containsBinary
Determines whether a binary metadata with the specified name and value is present.
- Type Parameters:
T
- the binary metadata message type- Parameters:
name
- a binary metadata name without the binary name suffix-bin
value
- a metadata value- Returns:
- true if a binary metadata is present, false otherwise
-
getBinary
<T extends com.google.protobuf.MessageLite> Optional<T> getBinary(CharSequence name, T defaultMessageInstance) throws IllegalArgumentException Returns the value of the binary metadata with the specified name.
If there are multiple metadata with the same name, the first one is returned.
- Type Parameters:
T
- the binary metadata message type- Parameters:
name
- a binary metadata name without the binary name suffix-bin
defaultMessageInstance
- the default message instance- Returns:
- an optional returning the decoded value of the binary metadata or an empty optional if there's no metadata with the specified name
- Throws:
IllegalArgumentException
- if there was an error parsing the value
-
getAllBinary
<T extends com.google.protobuf.MessageLite> List<T> getAllBinary(CharSequence name, T defaultMessageInstance) throws IllegalArgumentException Returns the values of all binary metadata with the specified name.
- Type Parameters:
T
- the binary metadata message type- Parameters:
name
- a binary metadata name without the binary name suffix-bin
defaultMessageInstance
- the default message instance- Returns:
- a list of decoded binary metadata values or an empty list if there's no metadata with the specified name
- Throws:
IllegalArgumentException
- if there was an error parsing the value
-