Class ImmutableSetAnswer

java.lang.Object
io.dialob.session.engine.session.command.ImmutableSetAnswer
All Implemented Interfaces:
AbstractUpdateCommand<ItemId,ItemState>, Command<ItemState>, ItemUpdateCommand, SetAnswer, UpdateCommand<ItemId,ItemState>, Serializable

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

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

See Also:
  • Method Details

    • getTriggers

      public com.google.common.collect.ImmutableList<Trigger<ItemState>> getTriggers()
      Specified by:
      getTriggers in interface Command<ItemState>
      Returns:
      The value of the triggers attribute
    • getTargetId

      public ItemId getTargetId()
      Specified by:
      getTargetId in interface UpdateCommand<ItemId,ItemState>
      Returns:
      The value of the targetId attribute
    • getAnswer

      @Nullable public Object getAnswer()
      Specified by:
      getAnswer in interface SetAnswer
      Returns:
      The value of the answer attribute
    • withTriggers

      @SafeVarargs public final ImmutableSetAnswer withTriggers(Trigger<ItemState>... elements)
      Copy the current immutable object with elements that replace the content of triggers.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withTriggers

      public final ImmutableSetAnswer withTriggers(Iterable<? extends Trigger<ItemState>> elements)
      Copy the current immutable object with elements that replace the content of triggers. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of triggers elements to set
      Returns:
      A modified copy or this if not changed
    • withTargetId

      public final ImmutableSetAnswer withTargetId(ItemId value)
      Copy the current immutable object by setting a value for the targetId attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Specified by:
      withTargetId in interface UpdateCommand<ItemId,ItemState>
      Parameters:
      value - A new value for targetId
      Returns:
      A modified copy or the this object
    • withAnswer

      public final ImmutableSetAnswer withAnswer(@Nullable Object value)
      Copy the current immutable object by setting a value for the answer attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for answer (can be null)
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableSetAnswer 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: triggers, targetId, answer.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableSetAnswer of(ItemId targetId, @Nullable Object answer, List<Trigger<ItemState>> triggers)
      Construct a new immutable SetAnswer instance.
      Parameters:
      targetId - The value for the targetId attribute
      answer - The value for the answer attribute
      triggers - The value for the triggers attribute
      Returns:
      An immutable SetAnswer instance
    • of

      public static ImmutableSetAnswer of(ItemId targetId, @Nullable Object answer, Iterable<? extends Trigger<ItemState>> triggers)
      Construct a new immutable SetAnswer instance.
      Parameters:
      targetId - The value for the targetId attribute
      answer - The value for the answer attribute
      triggers - The value for the triggers attribute
      Returns:
      An immutable SetAnswer instance
    • copyOf

      public static ImmutableSetAnswer copyOf(SetAnswer instance)
      Creates an immutable copy of a SetAnswer 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 SetAnswer instance
    • builder

      public static ImmutableSetAnswer.Builder builder()
      Creates a builder for ImmutableSetAnswer.
       ImmutableSetAnswer.builder()
          .addTriggers|addAllTriggers(io.dialob.session.engine.session.command.Trigger<io.dialob.session.engine.session.model.ItemState>) // triggers elements
          .targetId(io.dialob.session.engine.session.model.ItemId) // required targetId
          .answer(Object | null) // nullable answer
          .build();
       
      Returns:
      A new ImmutableSetAnswer builder