Class Metadata
- java.lang.Object
-
- org.eclipse.microprofile.reactive.messaging.Metadata
-
public class Metadata extends Object implements Iterable<Object>
Message metadata containers.This class stores message metadata that can be related to the transport layer or to the business / application.
Instances of this class are immutable. Modification operation returned new instances. Contained instances are not constrained, but should be immutable. Only one instance of each class can be stored, as the class is used to retrieve the metadata.
You can creates new instances using the
of(Object...)
andfrom(Iterable)
methods.IMPORTANT: Experimental.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Metadata
copy()
Copies the currentMetadata
instance.static Metadata
empty()
Returns an empty set of metadata.static Metadata
from(Iterable<Object> iterable)
Iterator<Object>
iterator()
static Metadata
of(Object... metadata)
Returns an instance ofMetadata
containing multiple values.Metadata
with(Object meta)
Creates a new instance ofMetadata
with the current entries, plusmeta
.Metadata
without(Class<?> clazz)
Creates a new instance ofMetadata
with the current entries, minus the entry associated with the given class.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
empty
public static Metadata empty()
Returns an empty set of metadata.- Returns:
- the empty instance
-
of
public static Metadata of(Object... metadata)
Returns an instance ofMetadata
containing multiple values.- Parameters:
metadata
- the metadata, must not benull
, must not containnull
. The contained metadata must not have the same class.- Returns:
- the new metadata
-
with
public Metadata with(Object meta)
Creates a new instance ofMetadata
with the current entries, plusmeta
. If the current set of metadata contains already an instance of the class ofmeta
, the value is replaced in the returnedMetadata
.- Parameters:
meta
- the metadata to be added, must not benull
.- Returns:
- the new instance of
Metadata
-
without
public Metadata without(Class<?> clazz)
Creates a new instance ofMetadata
with the current entries, minus the entry associated with the given class. If there is no instance of the class in the current set of metadata, the same entries are composing returned instance of metadata.- Parameters:
clazz
- instance from this class are removed from the metadata.- Returns:
- the new instance of
Metadata
-
-