Package com.hazelcast.jet.datamodel
Class ItemsByTag
- java.lang.Object
-
- com.hazelcast.jet.datamodel.ItemsByTag
-
public final class ItemsByTag extends java.lang.Object
A heterogeneous map fromTag<E>
toE
, whereE
can be different for each tag. The value associated with a tag may benull
.This is a less type-safe, but more flexible alternative to a tuple. The tuple has a fixed number of integer-indexed, statically-typed fields, and
ItemsByTag
has a variable number of tag-indexed fields whose whose static type is encoded in the tags.- Since:
- Jet 3.0
-
-
Constructor Summary
Constructors Constructor Description ItemsByTag()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
<E> E
get(Tag<E> tag)
Retrieves the value associated with the supplied tag and throws an exception if there is none.int
hashCode()
static ItemsByTag
itemsByTag(java.lang.Object... tagsAndVals)
Accepts an argument list of alternating tags and values, interprets them as a list of tag-value pairs, and returns anItemsByTag
populated with these pairs.<E> void
put(Tag<E> tag, E value)
Associates the supplied value with the supplied tag.java.lang.String
toString()
-
-
-
Method Detail
-
itemsByTag
@Nonnull public static ItemsByTag itemsByTag(@Nonnull java.lang.Object... tagsAndVals)
Accepts an argument list of alternating tags and values, interprets them as a list of tag-value pairs, and returns anItemsByTag
populated with these pairs.
-
get
@Nullable public <E> E get(@Nonnull Tag<E> tag)
Retrieves the value associated with the supplied tag and throws an exception if there is none. The tag argument must not benull
, but the returned value may be, if anull
value is explicitly associated with a tag.- Throws:
java.lang.IllegalArgumentException
- if there is no value associated with the supplied tag
-
put
public <E> void put(@Nonnull Tag<E> tag, @Nullable E value)
Associates the supplied value with the supplied tag. The tag must not benull
, but the value may be, and in that case the tag will be associated with anull
value.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-