Interface MessageMetadata
Local metadata follows the same message envelope while it is used in-process. A newly created message starts with
empty local metadata unless its builder or implementation explicitly supplies a snapshot. Local metadata is separate
from portable headers; connectors and generic message mappers must never serialize it or
map it to a transport. Publishing a local value requires an explicit, application-controlled promotion to a
portable header, including any necessary redaction and size limit.
This interface is sealed because its single abstract accessor would otherwise make it a lambda target. Lambdas
cannot implement the value-based Object.equals(Object) and Object.hashCode() required by this type.
Keeping implementations under Helidon control also guarantees value-independent Object.toString() output
and a stable, immutable, non-null value map containing no null names or values.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classMutable local-metadata builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageMetadata.Builderbuilder()Create a mutable builder which produces immutable snapshots.static MessageMetadata.Builderbuilder(MessageMetadata metadata) Create a mutable builder from existing metadata.default booleanWhether an exact metadata name is present.static MessageMetadataempty()Empty local metadata.default booleanisEmpty()Whether there are no metadata values.default intsize()Number of metadata values.Text value with an exact metadata name.default Optional<MessageHeaderValue> Value with an exact metadata name.values()Immutable exact-name values.
-
Method Details
-
empty
-
builder
Create a mutable builder which produces immutable snapshots.- Returns:
- builder
-
builder
Create a mutable builder from existing metadata.- Parameters:
metadata- existing metadata- Returns:
- builder
- Throws:
NullPointerException- ifmetadataisnull
-
values
Map<String, MessageHeaderValue> values()Immutable exact-name values.- Returns:
- stable, immutable, non-null metadata values
-
size
default int size()Number of metadata values.- Returns:
- value count
-
isEmpty
default boolean isEmpty()Whether there are no metadata values.- Returns:
- whether empty
-
contains
Whether an exact metadata name is present.- Parameters:
name- exact metadata name- Returns:
- whether present
-
value
Value with an exact metadata name.- Parameters:
name- exact metadata name- Returns:
- metadata value, or empty when absent
-
text
Text value with an exact metadata name.This method throws when the value exists but is not a
MessageHeaderValue.TextValue; it never stringifies typed values.- Parameters:
name- exact metadata name- Returns:
- text value, or empty only when absent
- Throws:
IllegalStateException- if the value is present but is not text
-