Interface MutableAttributes

All Superinterfaces:
Attributes
All Known Implementing Classes:
AbstractMutableAttributes, HashMutableAttributes

public interface MutableAttributes extends Attributes
Provides mutable access to workflow attributes. MutableAttributes extends the base Attributes interface to add methods for setting, updating, and removing attribute values. This interface is used for building and modifying workflow data during execution.

MutableAttributes provides both imperative (set) and functional (with) methods for each attribute type. The imperative methods modify the current instance, while the functional methods return a new instance with the modification applied, supporting fluent programming patterns.

All setter methods throw AttributeException if there are validation errors or type conflicts. The interface supports various data types including primitives, objects, and binary data.

Since:
1.0
See Also:
  • Method Details

    • setBoolean

      void setBoolean(String key, boolean value) throws AttributeException
      Sets a boolean attribute value.
      Parameters:
      key - the attribute key
      value - the boolean value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withBoolean

      MutableAttributes withBoolean(String key, boolean value) throws AttributeException
      Creates a new MutableAttributes instance with the specified boolean value.
      Parameters:
      key - the attribute key
      value - the boolean value to set
      Returns:
      a new MutableAttributes instance with the boolean value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setData

      void setData(String key, byte[] value) throws AttributeException
      Sets a binary data attribute value.
      Parameters:
      key - the attribute key
      value - the byte array value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withData

      MutableAttributes withData(String key, byte[] value) throws AttributeException
      Creates a new MutableAttributes instance with the specified binary data value.
      Parameters:
      key - the attribute key
      value - the byte array value to set
      Returns:
      a new MutableAttributes instance with the binary data value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setInstant

      void setInstant(String key, Instant value) throws AttributeException
      Sets an Instant attribute value.
      Parameters:
      key - the attribute key
      value - the Instant value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withInstant

      MutableAttributes withInstant(String key, Instant value) throws AttributeException
      Creates a new MutableAttributes instance with the specified Instant value.
      Parameters:
      key - the attribute key
      value - the Instant value to set
      Returns:
      a new MutableAttributes instance with the Instant value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setDouble

      void setDouble(String key, double value) throws AttributeException
      Sets a double attribute value.
      Parameters:
      key - the attribute key
      value - the double value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withDouble

      MutableAttributes withDouble(String key, double value) throws AttributeException
      Creates a new MutableAttributes instance with the specified double value.
      Parameters:
      key - the attribute key
      value - the double value to set
      Returns:
      a new MutableAttributes instance with the double value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setInt

      void setInt(String key, int value) throws AttributeException
      Sets an integer attribute value.
      Parameters:
      key - the attribute key
      value - the integer value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withInt

      MutableAttributes withInt(String key, int value) throws AttributeException
      Creates a new MutableAttributes instance with the specified integer value.
      Parameters:
      key - the attribute key
      value - the integer value to set
      Returns:
      a new MutableAttributes instance with the integer value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setLong

      void setLong(String key, long value) throws AttributeException
      Sets a long attribute value.
      Parameters:
      key - the attribute key
      value - the long value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withLong

      MutableAttributes withLong(String key, long value) throws AttributeException
      Creates a new MutableAttributes instance with the specified long value.
      Parameters:
      key - the attribute key
      value - the long value to set
      Returns:
      a new MutableAttributes instance with the long value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setObject

      void setObject(String key, Object value) throws AttributeException
      Sets an object attribute value.
      Parameters:
      key - the attribute key
      value - the object value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withObject

      MutableAttributes withObject(String key, Object value) throws AttributeException
      Creates a new MutableAttributes instance with the specified object value.
      Parameters:
      key - the attribute key
      value - the object value to set
      Returns:
      a new MutableAttributes instance with the object value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setString

      void setString(String key, String value) throws AttributeException
      Sets a string attribute value.
      Parameters:
      key - the attribute key
      value - the string value to set
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withString

      MutableAttributes withString(String key, String value) throws AttributeException
      Creates a new MutableAttributes instance with the specified string value.
      Parameters:
      key - the attribute key
      value - the string value to set
      Returns:
      a new MutableAttributes instance with the string value
      Throws:
      AttributeException - if there's a validation error or type conflict
    • setAttributes

      void setAttributes(MutableAttributes other) throws AttributeException
      Sets all attributes from another MutableAttributes instance.
      Parameters:
      other - the other MutableAttributes instance to copy from
      Throws:
      AttributeException - if there's a validation error or type conflict
    • withAttributes

      Creates a new MutableAttributes instance with all attributes from another instance.
      Parameters:
      other - the other MutableAttributes instance to copy from
      Returns:
      a new MutableAttributes instance with all attributes from the other instance
      Throws:
      AttributeException - if there's a validation error or type conflict
    • remove

      void remove(String key) throws AttributeException
      Removes the attribute with the specified key.
      Parameters:
      key - the key of the attribute to remove
      Throws:
      AttributeException - if there's an error removing the attribute
    • remove

      void remove() throws AttributeException
      Removes all attributes from this instance.
      Throws:
      AttributeException - if there's an error removing the attributes
    • mutableAttributes

      static MutableAttributes mutableAttributes()
      Creates a new empty MutableAttributes instance.
      Returns:
      a new empty MutableAttributes instance
    • toImmutable

      Attributes toImmutable() throws AttributeException
      Converts this MutableAttributes instance to an ImmutableAttributes instance. This is useful for passing attributes to workflow operations that require immutable data.
      Returns:
      an ImmutableAttributes instance containing all attributes from this instance
      Throws:
      AttributeException - if there's an error during conversion