Class ImmutableConditionalValue<T>

java.lang.Object
io.dialob.session.engine.program.model.ImmutableConditionalValue<T>
All Implemented Interfaces:
ConditionalValue<T>, ProgramNode, Value<T>, Serializable

@Generated(from="ConditionalValue", generator="Immutables") @ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableConditionalValue<T> extends Object implements ConditionalValue<T>
Immutable implementation of ConditionalValue.

Use the builder to create immutable instances: ImmutableConditionalValue.builder().

See Also:
  • Method Details

    • getWhen

      public Expression getWhen()
      Specified by:
      getWhen in interface ConditionalValue<T>
      Returns:
      The value of the when attribute
    • getValue

      @Nullable public T getValue()
      Specified by:
      getValue in interface ConditionalValue<T>
      Returns:
      The value of the value attribute
    • getFallbackValue

      @Nullable public T getFallbackValue()
      Specified by:
      getFallbackValue in interface ConditionalValue<T>
      Returns:
      The value of the fallbackValue attribute
    • getValueType

      public ValueType getValueType()
      Specified by:
      getValueType in interface ConditionalValue<T>
      Specified by:
      getValueType in interface Value<T>
      Returns:
      The value of the valueType attribute
    • withWhen

      public final ImmutableConditionalValue<T> withWhen(Expression value)
      Copy the current immutable object by setting a value for the when attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for when
      Returns:
      A modified copy or the this object
    • withValue

      public final ImmutableConditionalValue<T> withValue(@Nullable T 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
    • withFallbackValue

      public final ImmutableConditionalValue<T> withFallbackValue(@Nullable T value)
      Copy the current immutable object by setting a value for the fallbackValue attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for fallbackValue (can be null)
      Returns:
      A modified copy or the this object
    • withValueType

      public final ImmutableConditionalValue<T> withValueType(ValueType value)
      Copy the current immutable object by setting a value for the valueType attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for valueType
      Returns:
      A modified copy or the this object
    • equals

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

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

      public static <T> ImmutableConditionalValue<T> copyOf(ConditionalValue<T> instance)
      Creates an immutable copy of a ConditionalValue value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      T - generic parameter T
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable ConditionalValue instance
    • builder

      public static <T> ImmutableConditionalValue.Builder<T> builder()
      Creates a builder for ImmutableConditionalValue.
       ImmutableConditionalValue.<T>builder()
          .when(io.dialob.session.engine.program.model.Expression) // required when
          .value(T | null) // nullable value
          .fallbackValue(T | null) // nullable fallbackValue
          .valueType(io.dialob.rule.parser.api.ValueType) // required valueType
          .build();
       
      Type Parameters:
      T - generic parameter T
      Returns:
      A new ImmutableConditionalValue builder