Class EmptyAttributes

java.lang.Object
com.yworkflow.definition.model.attribute.EmptyAttributes
All Implemented Interfaces:
Attributes, MutableAttributes

public class EmptyAttributes extends Object implements MutableAttributes
Empty attributes to use when Null Object is needed.
  • Constructor Details

    • EmptyAttributes

      public EmptyAttributes()
      Default Constructor.
  • Method Details

    • get

      public Optional<Object> get(String key)
      Description copied from interface: Attributes
      Gets an attribute value as an Object. This method returns the raw value without type checking.
      Specified by:
      get in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the attribute value if found, empty otherwise
    • getBoolean

      public Optional<Boolean> getBoolean(String key)
      Description copied from interface: Attributes
      Gets a boolean attribute value.
      Specified by:
      getBoolean in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the boolean value if found and type matches, empty otherwise
    • getData

      public Optional<byte[]> getData(String key)
      Description copied from interface: Attributes
      Gets a binary data attribute value.
      Specified by:
      getData in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the byte array if found and type matches, empty otherwise
    • getInstant

      public Optional<Instant> getInstant(String key)
      Description copied from interface: Attributes
      Gets an Instant attribute value.
      Specified by:
      getInstant in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the Instant if found and type matches, empty otherwise
    • getDouble

      public Optional<Double> getDouble(String key)
      Description copied from interface: Attributes
      Gets a double attribute value.
      Specified by:
      getDouble in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the double value if found and type matches, empty otherwise
    • getInt

      public Optional<Integer> getInt(String key)
      Description copied from interface: Attributes
      Gets an integer attribute value.
      Specified by:
      getInt in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the integer value if found and type matches, empty otherwise
    • getKeys

      public Collection<String> getKeys()
      Description copied from interface: Attributes
      Gets all attribute keys.
      Specified by:
      getKeys in interface Attributes
      Returns:
      a collection of all attribute keys
    • getKeys

      public Collection<String> getKeys(AttributeType<?> type)
      Description copied from interface: Attributes
      Gets all attribute keys of the specified type.
      Specified by:
      getKeys in interface Attributes
      Parameters:
      type - the attribute type to filter by
      Returns:
      a collection of keys for attributes of the specified type
    • getKeys

      public Collection<String> getKeys(String prefix)
      Description copied from interface: Attributes
      Gets all attribute keys with the specified prefix.
      Specified by:
      getKeys in interface Attributes
      Parameters:
      prefix - the prefix to filter by
      Returns:
      a collection of keys that start with the specified prefix
    • getKeys

      public Collection<String> getKeys(String prefix, AttributeType<?> type)
      Description copied from interface: Attributes
      Gets all attribute keys with the specified prefix and type.
      Specified by:
      getKeys in interface Attributes
      Parameters:
      prefix - the prefix to filter by
      type - the attribute type to filter by
      Returns:
      a collection of keys that start with the prefix and are of the specified type
    • getLong

      public Optional<Long> getLong(String key)
      Description copied from interface: Attributes
      Gets a long attribute value.
      Specified by:
      getLong in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the long value if found and type matches, empty otherwise
    • getObject

      public Optional<Object> getObject(String key)
      Description copied from interface: Attributes
      Gets an object attribute value.
      Specified by:
      getObject in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the object value if found and type matches, empty otherwise
    • getString

      public Optional<String> getString(String key)
      Description copied from interface: Attributes
      Gets a string attribute value.
      Specified by:
      getString in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the string value if found and type matches, empty otherwise
    • getType

      public Optional<AttributeType<?>> getType(String key)
      Description copied from interface: Attributes
      Gets the type of attribute.
      Specified by:
      getType in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the attribute type if the key exists, empty otherwise
    • getEntry

      public Optional<AttributeEntry<?>> getEntry(String key)
      Description copied from interface: Attributes
      Gets the complete attribute entry for a key.
      Specified by:
      getEntry in interface Attributes
      Parameters:
      key - the attribute key
      Returns:
      an Optional containing the attribute entry if found, empty otherwise
    • containsKey

      public boolean containsKey(String key)
      Description copied from interface: Attributes
      Checks if an attribute with the specified key exists.
      Specified by:
      containsKey in interface Attributes
      Parameters:
      key - the attribute key to check
      Returns:
      true if the key exists, false otherwise
    • toMap

      public Map<String,Object> toMap()
      Description copied from interface: Attributes
      Converts this Attributes instance to a Map representation. Only attributes with non-null values are included in the resulting map.
      Specified by:
      toMap in interface Attributes
      Returns:
      a Map containing the attribute key-value pairs
    • setBoolean

      public void setBoolean(String key, boolean value)
      Description copied from interface: MutableAttributes
      Sets a boolean attribute value.
      Specified by:
      setBoolean in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the boolean value to set
    • withBoolean

      public MutableAttributes withBoolean(String key, boolean value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified boolean value.
      Specified by:
      withBoolean in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the boolean value to set
      Returns:
      a new MutableAttributes instance with the boolean value
    • setData

      public void setData(String key, byte[] value)
      Description copied from interface: MutableAttributes
      Sets a binary data attribute value.
      Specified by:
      setData in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the byte array value to set
    • withData

      public MutableAttributes withData(String key, byte[] value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified binary data value.
      Specified by:
      withData in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the byte array value to set
      Returns:
      a new MutableAttributes instance with the binary data value
    • setInstant

      public void setInstant(String key, Instant value)
      Description copied from interface: MutableAttributes
      Sets an Instant attribute value.
      Specified by:
      setInstant in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the Instant value to set
    • withInstant

      public MutableAttributes withInstant(String key, Instant value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified Instant value.
      Specified by:
      withInstant in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the Instant value to set
      Returns:
      a new MutableAttributes instance with the Instant value
    • setDouble

      public void setDouble(String key, double value)
      Description copied from interface: MutableAttributes
      Sets a double attribute value.
      Specified by:
      setDouble in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the double value to set
    • withDouble

      public MutableAttributes withDouble(String key, double value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified double value.
      Specified by:
      withDouble in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the double value to set
      Returns:
      a new MutableAttributes instance with the double value
    • setInt

      public void setInt(String key, int value)
      Description copied from interface: MutableAttributes
      Sets an integer attribute value.
      Specified by:
      setInt in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the integer value to set
    • withInt

      public MutableAttributes withInt(String key, int value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified integer value.
      Specified by:
      withInt in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the integer value to set
      Returns:
      a new MutableAttributes instance with the integer value
    • setLong

      public void setLong(String key, long value)
      Description copied from interface: MutableAttributes
      Sets a long attribute value.
      Specified by:
      setLong in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the long value to set
    • withLong

      public MutableAttributes withLong(String key, long value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified long value.
      Specified by:
      withLong in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the long value to set
      Returns:
      a new MutableAttributes instance with the long value
    • setObject

      public void setObject(String key, Object value)
      Description copied from interface: MutableAttributes
      Sets an object attribute value.
      Specified by:
      setObject in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the object value to set
    • withObject

      public MutableAttributes withObject(String key, Object value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified object value.
      Specified by:
      withObject in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the object value to set
      Returns:
      a new MutableAttributes instance with the object value
    • setString

      public void setString(String key, String value)
      Description copied from interface: MutableAttributes
      Sets a string attribute value.
      Specified by:
      setString in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the string value to set
    • withString

      public MutableAttributes withString(String key, String value)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with the specified string value.
      Specified by:
      withString in interface MutableAttributes
      Parameters:
      key - the attribute key
      value - the string value to set
      Returns:
      a new MutableAttributes instance with the string value
    • setAttributes

      public void setAttributes(MutableAttributes other)
      Description copied from interface: MutableAttributes
      Sets all attributes from another MutableAttributes instance.
      Specified by:
      setAttributes in interface MutableAttributes
      Parameters:
      other - the other MutableAttributes instance to copy from
    • withAttributes

      public MutableAttributes withAttributes(MutableAttributes other)
      Description copied from interface: MutableAttributes
      Creates a new MutableAttributes instance with all attributes from another instance.
      Specified by:
      withAttributes in interface MutableAttributes
      Parameters:
      other - the other MutableAttributes instance to copy from
      Returns:
      a new MutableAttributes instance with all attributes from the other instance
    • remove

      public void remove(String key)
      Description copied from interface: MutableAttributes
      Removes the attribute with the specified key.
      Specified by:
      remove in interface MutableAttributes
      Parameters:
      key - the key of the attribute to remove
    • remove

      public void remove()
      Description copied from interface: MutableAttributes
      Removes all attributes from this instance.
      Specified by:
      remove in interface MutableAttributes
    • toImmutable

      public Attributes toImmutable()
      Description copied from interface: MutableAttributes
      Converts this MutableAttributes instance to an ImmutableAttributes instance. This is useful for passing attributes to workflow operations that require immutable data.
      Specified by:
      toImmutable in interface MutableAttributes
      Returns:
      an ImmutableAttributes instance containing all attributes from this instance