Class ImmutableFormItem

java.lang.Object
io.dialob.session.engine.program.model.ImmutableFormItem
All Implemented Interfaces:
DisplayItem, FormItem, Item, ProgramNode, StructuralNode, Serializable

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

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

See Also:
  • Method Details

    • isPrototype

      public boolean isPrototype()
      Specified by:
      isPrototype in interface StructuralNode
      Returns:
      The value of the isPrototype attribute
    • getId

      public ItemId getId()
      Specified by:
      getId in interface Item
      Returns:
      The value of the id attribute
    • getType

      public String getType()
      Specified by:
      getType in interface Item
      Returns:
      The value of the type attribute
    • getValueType

      @Nullable public ValueType getValueType()
      Specified by:
      getValueType in interface Item
      Returns:
      The value of the valueType attribute
    • getValueSetId

      public Optional<String> getValueSetId()
      Specified by:
      getValueSetId in interface Item
      Returns:
      The value of the valueSetId attribute
    • getDefaultValue

      public Optional<Object> getDefaultValue()
      Specified by:
      getDefaultValue in interface Item
      Returns:
      The value of the defaultValue attribute
    • getView

      @Nullable public String getView()
      Specified by:
      getView in interface DisplayItem
      Returns:
      The value of the view attribute
    • getProps

      @Nullable public Map<String,Object> getProps()
      Specified by:
      getProps in interface DisplayItem
      Returns:
      The value of the props attribute
    • getClassName

      public Optional<Expression> getClassName()
      Specified by:
      getClassName in interface DisplayItem
      Returns:
      The value of the className attribute
    • getActiveExpression

      public Optional<Expression> getActiveExpression()
      Specified by:
      getActiveExpression in interface DisplayItem
      Returns:
      The value of the activeExpression attribute
    • getRequiredExpression

      public Optional<Expression> getRequiredExpression()
      Specified by:
      getRequiredExpression in interface DisplayItem
      Returns:
      The value of the requiredExpression attribute
    • getDisabledExpression

      public Optional<Expression> getDisabledExpression()
      Specified by:
      getDisabledExpression in interface DisplayItem
      Returns:
      The value of the disabledExpression attribute
    • getLabelExpression

      public Optional<Expression> getLabelExpression()
      Specified by:
      getLabelExpression in interface DisplayItem
      Returns:
      The value of the labelExpression attribute
    • getDescriptionExpression

      public Optional<Expression> getDescriptionExpression()
      Specified by:
      getDescriptionExpression in interface DisplayItem
      Returns:
      The value of the descriptionExpression attribute
    • getErrors

      public List<Error> getErrors()
      Specified by:
      getErrors in interface DisplayItem
      Returns:
      The value of the errors attribute
    • withIsPrototype

      public final ImmutableFormItem withIsPrototype(boolean value)
      Copy the current immutable object by setting a value for the isPrototype attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for isPrototype
      Returns:
      A modified copy or the this object
    • withId

      public final ImmutableFormItem withId(ItemId value)
      Copy the current immutable object by setting a value for the id attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for id
      Returns:
      A modified copy or the this object
    • withType

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

      public final ImmutableFormItem withValueType(@Nullable 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 (can be null)
      Returns:
      A modified copy or the this object
    • withValueSetId

      public final ImmutableFormItem withValueSetId(String value)
      Copy the current immutable object by setting a present value for the optional valueSetId attribute.
      Parameters:
      value - The value for valueSetId
      Returns:
      A modified copy or this if not changed
    • withValueSetId

      public final ImmutableFormItem withValueSetId(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the valueSetId attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for valueSetId
      Returns:
      A modified copy or this if not changed
    • withDefaultValue

      public final ImmutableFormItem withDefaultValue(Object value)
      Copy the current immutable object by setting a present value for the optional defaultValue attribute.
      Parameters:
      value - The value for defaultValue
      Returns:
      A modified copy or this if not changed
    • withDefaultValue

      public final ImmutableFormItem withDefaultValue(Optional<? extends Object> optional)
      Copy the current immutable object by setting an optional value for the defaultValue attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for defaultValue
      Returns:
      A modified copy or this if not changed
    • withView

      public final ImmutableFormItem withView(@Nullable String value)
      Copy the current immutable object by setting a value for the view attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for view (can be null)
      Returns:
      A modified copy or the this object
    • withProps

      public final ImmutableFormItem withProps(@Nullable Map<String,? extends Object> entries)
      Copy the current immutable object by replacing the props map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to replace the props map
      Returns:
      A modified copy or this if not changed
    • withClassName

      public final ImmutableFormItem withClassName(Expression value)
      Copy the current immutable object by setting a present value for the optional className attribute.
      Parameters:
      value - The value for className
      Returns:
      A modified copy or this if not changed
    • withClassName

      public final ImmutableFormItem withClassName(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the className attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for className
      Returns:
      A modified copy or this if not changed
    • withActiveExpression

      public final ImmutableFormItem withActiveExpression(Expression value)
      Copy the current immutable object by setting a present value for the optional activeExpression attribute.
      Parameters:
      value - The value for activeExpression
      Returns:
      A modified copy or this if not changed
    • withActiveExpression

      public final ImmutableFormItem withActiveExpression(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the activeExpression attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for activeExpression
      Returns:
      A modified copy or this if not changed
    • withRequiredExpression

      public final ImmutableFormItem withRequiredExpression(Expression value)
      Copy the current immutable object by setting a present value for the optional requiredExpression attribute.
      Parameters:
      value - The value for requiredExpression
      Returns:
      A modified copy or this if not changed
    • withRequiredExpression

      public final ImmutableFormItem withRequiredExpression(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the requiredExpression attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for requiredExpression
      Returns:
      A modified copy or this if not changed
    • withDisabledExpression

      public final ImmutableFormItem withDisabledExpression(Expression value)
      Copy the current immutable object by setting a present value for the optional disabledExpression attribute.
      Parameters:
      value - The value for disabledExpression
      Returns:
      A modified copy or this if not changed
    • withDisabledExpression

      public final ImmutableFormItem withDisabledExpression(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the disabledExpression attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for disabledExpression
      Returns:
      A modified copy or this if not changed
    • withLabelExpression

      public final ImmutableFormItem withLabelExpression(Expression value)
      Copy the current immutable object by setting a present value for the optional labelExpression attribute.
      Parameters:
      value - The value for labelExpression
      Returns:
      A modified copy or this if not changed
    • withLabelExpression

      public final ImmutableFormItem withLabelExpression(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the labelExpression attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for labelExpression
      Returns:
      A modified copy or this if not changed
    • withDescriptionExpression

      public final ImmutableFormItem withDescriptionExpression(Expression value)
      Copy the current immutable object by setting a present value for the optional descriptionExpression attribute.
      Parameters:
      value - The value for descriptionExpression
      Returns:
      A modified copy or this if not changed
    • withDescriptionExpression

      public final ImmutableFormItem withDescriptionExpression(Optional<? extends Expression> optional)
      Copy the current immutable object by setting an optional value for the descriptionExpression attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for descriptionExpression
      Returns:
      A modified copy or this if not changed
    • withErrors

      public final ImmutableFormItem withErrors(Error... elements)
      Copy the current immutable object with elements that replace the content of errors.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withErrors

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

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableFormItem 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: isPrototype, id, type, valueType, valueSetId, defaultValue, view, props, className, activeExpression, requiredExpression, disabledExpression, labelExpression, descriptionExpression, errors.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

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

      public static ImmutableFormItem.Builder builder()
      Creates a builder for ImmutableFormItem.
       ImmutableFormItem.builder()
          .isPrototype(boolean) // optional isPrototype
          .id(io.dialob.session.engine.session.model.ItemId) // required id
          .type(String) // required type
          .valueType(io.dialob.rule.parser.api.ValueType | null) // nullable valueType
          .valueSetId(Optional<String>) // optional valueSetId
          .defaultValue(Optional<Object>) // optional defaultValue
          .view(String | null) // nullable view
          .props(Map<String, Object> | null) // nullable props
          .className(Optional<io.dialob.session.engine.program.model.Expression>) // optional className
          .activeExpression(Optional<io.dialob.session.engine.program.model.Expression>) // optional activeExpression
          .requiredExpression(Optional<io.dialob.session.engine.program.model.Expression>) // optional requiredExpression
          .disabledExpression(Optional<io.dialob.session.engine.program.model.Expression>) // optional disabledExpression
          .labelExpression(Optional<io.dialob.session.engine.program.model.Expression>) // optional labelExpression
          .descriptionExpression(Optional<io.dialob.session.engine.program.model.Expression>) // optional descriptionExpression
          .addErrors|addAllErrors(io.dialob.session.engine.program.model.Error) // errors elements
          .build();
       
      Returns:
      A new ImmutableFormItem builder