Class ImmutableItemIndex

java.lang.Object
io.dialob.session.engine.session.model.ImmutableItemIndex
All Implemented Interfaces:
ItemId, ItemIndex, Serializable

@Generated(from="ItemIndex", generator="Immutables") @ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableItemIndex extends Object implements ItemIndex
Immutable implementation of ItemIndex.

Use the builder to create immutable instances: ImmutableItemIndex.builder(). Use the static factory method to create immutable instances: ImmutableItemIndex.of().

See Also:
  • Method Details

    • getParent

      public Optional<ItemId> getParent()
      Specified by:
      getParent in interface ItemId
      Returns:
      The value of the parent attribute
    • getIndex

      public Integer getIndex()
      Specified by:
      getIndex in interface ItemIndex
      Returns:
      The value of the index attribute
    • withParent

      public final ImmutableItemIndex withParent(ItemId value)
      Copy the current immutable object by setting a present value for the optional parent attribute.
      Specified by:
      withParent in interface ItemId
      Parameters:
      value - The value for parent
      Returns:
      A modified copy or this if not changed
    • withParent

      public final ImmutableItemIndex withParent(Optional<? extends ItemId> optional)
      Copy the current immutable object by setting an optional value for the parent attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Specified by:
      withParent in interface ItemId
      Parameters:
      optional - An optional value for parent
      Returns:
      A modified copy or this if not changed
    • withIndex

      public final ImmutableItemIndex withIndex(Integer value)
      Copy the current immutable object by setting a value for the index attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for index
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableItemIndex that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: parent, index.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value ItemIndex with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • of

      public static ImmutableItemIndex of(Integer index, Optional<? extends ItemId> parent)
      Construct a new immutable ItemIndex instance.
      Parameters:
      index - The value for the index attribute
      parent - The value for the parent attribute
      Returns:
      An immutable ItemIndex instance
    • copyOf

      public static ImmutableItemIndex copyOf(ItemIndex instance)
      Creates an immutable copy of a ItemIndex value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ItemIndex instance
    • builder

      public static ImmutableItemIndex.Builder builder()
      Creates a builder for ImmutableItemIndex.
       ImmutableItemIndex.builder()
          .parent(Optional<io.dialob.session.engine.session.model.ItemId>) // optional parent
          .index(Integer) // required index
          .build();
       
      Returns:
      A new ImmutableItemIndex builder