Class ImmutableSetVariableValue

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

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

Use the builder to create immutable instances: ImmutableSetVariableValue.builder(). Use the static factory method to create immutable instances: ImmutableSetVariableValue.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
    • getValue

      @Nullable public Object getValue()
      Specified by:
      getValue in interface SetVariableValue
      Returns:
      The value of the value attribute
    • withTriggers

      @SafeVarargs public final ImmutableSetVariableValue 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 ImmutableSetVariableValue 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 ImmutableSetVariableValue 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
    • withValue

      public final ImmutableSetVariableValue withValue(@Nullable Object value)
      Copy the current immutable object by setting a value for the value attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for value (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 ImmutableSetVariableValue 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, value.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

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

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

      public static ImmutableSetVariableValue.Builder builder()
      Creates a builder for ImmutableSetVariableValue.
       ImmutableSetVariableValue.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
          .value(Object | null) // nullable value
          .build();
       
      Returns:
      A new ImmutableSetVariableValue builder