Package io.smallrye.stork.api
Class Metadata<T extends Enum<T> & MetadataKey>
java.lang.Object
io.smallrye.stork.api.Metadata<T>
Service Instance metadata.
This class stores service instance metadata that can be used by the load balancer to select the service instance to use.
Instances of this class are immutable. Modification operations return new instances.
You can create new instances using theof(Class), of(Class, Map) and with(Enum, Object)methods.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe default metadata key.static enum -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Enum<T> & MetadataKey>
Metadata<T> empty()Returns an immutable, empty set of metadata.static <K extends Enum<K> & MetadataKey>
Metadata<K> Returns an instance ofMetadatacontaining an empty set of values.static <K extends Enum<K> & MetadataKey>
Metadata<K> Returns an instance ofMetadatacontaining metadata values.Creates a new instance ofMetadatawith the current entries, plusitem.
-
Method Details
-
empty
Returns an immutable, empty set of metadata.- Returns:
- the empty instance
-
of
public static <K extends Enum<K> & MetadataKey> Metadata<K> of(Class<K> key, Map<K, Object> metadata) Returns an instance ofMetadatacontaining metadata values.- Type Parameters:
K- the key type- Parameters:
key- the class of the key, must not benullmetadata- the metadata, must not benull, must not containnull, must not contain multiple objects of the same class- Returns:
- the new metadata
-
of
Returns an instance ofMetadatacontaining an empty set of values.- Type Parameters:
K- the type key type- Parameters:
key- the type of metadata, must not benull- Returns:
- the new metadata
-
with
Creates a new instance ofMetadatawith the current entries, plusitem. If the current set of metadata contains already an instance of the class ofitem, the value is replaced in the returnedMetadata.- Parameters:
key- the key, must not benullitem- the metadata to be added, must not benull.- Returns:
- the new instance of
Metadata
-
getMetadata
- Returns:
- the metadata
-