Class ItemsByTag

java.lang.Object
com.hazelcast.jet.datamodel.ItemsByTag

public final class ItemsByTag extends Object
A heterogeneous map from Tag<E> to E, where E can be different for each tag. The value associated with a tag may be null.

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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    <E> E
    get(Tag<E> tag)
    Retrieves the value associated with the supplied tag and throws an exception if there is none.
    int
     
    static ItemsByTag
    itemsByTag(Object... tagsAndVals)
    Accepts an argument list of alternating tags and values, interprets them as a list of tag-value pairs, and returns an ItemsByTag populated with these pairs.
    <E> void
    put(Tag<E> tag, E value)
    Associates the supplied value with the supplied tag.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ItemsByTag

      public ItemsByTag()
  • Method Details

    • itemsByTag

      @Nonnull public static ItemsByTag itemsByTag(@Nonnull Object... tagsAndVals)
      Accepts an argument list of alternating tags and values, interprets them as a list of tag-value pairs, and returns an ItemsByTag 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 be null, but the returned value may be, if a null value is explicitly associated with a tag.
      Throws:
      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 be null, but the value may be, and in that case the tag will be associated with a null value.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object