Class AbstractMutableAttributes
java.lang.Object
com.yworkflow.definition.model.attribute.AbstractAttributes
com.yworkflow.definition.model.attribute.AbstractMutableAttributes
- All Implemented Interfaces:
Attributes,MutableAttributes
- Direct Known Subclasses:
HashMutableAttributes
public abstract class AbstractMutableAttributes
extends AbstractAttributes
implements MutableAttributes
Abstract base class for mutable attribute collections. AbstractMutableAttributes extends
AbstractAttributes and provides a common implementation for the MutableAttributes interface.
- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetAttributes(MutableAttributes other) Sets all attributes from another MutableAttributes instance.voidsetBoolean(String key, boolean value) Sets a boolean attribute value.voidSets a binary data attribute value.voidSets a double attribute value.protected abstract <T> voidsetImpl(AttributeType<T> type, String key, T value) Abstract method to set an attribute value with the specified type and key.voidsetInstant(String key, Instant value) Sets an Instant attribute value.voidSets an integer attribute value.voidSets a long attribute value.voidSets an object attribute value.<T> voidsetRaw(AttributeType<T> type, String key, String value) Sets a raw attribute value by converting a string value to the specified type.voidSets a raw attribute value by automatically determining the type from the value.voidSets a string attribute value.toString()withAttributes(MutableAttributes other) Creates a new MutableAttributes instance with all attributes from another instance.withBoolean(String key, boolean value) Creates a new MutableAttributes instance with the specified boolean value.Creates a new MutableAttributes instance with the specified binary data value.withDouble(String key, double value) Creates a new MutableAttributes instance with the specified double value.withInstant(String key, Instant value) Creates a new MutableAttributes instance with the specified Instant value.Creates a new MutableAttributes instance with the specified integer value.Creates a new MutableAttributes instance with the specified long value.withObject(String key, Object value) Creates a new MutableAttributes instance with the specified object value.withString(String key, String value) Creates a new MutableAttributes instance with the specified string value.Methods inherited from class com.yworkflow.definition.model.attribute.AbstractAttributes
get, get, getBoolean, getData, getDouble, getInstant, getInt, getKeys, getKeys, getKeys, getLong, getObject, getStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.yworkflow.definition.model.attribute.Attributes
containsKey, get, getBoolean, getData, getDouble, getEntry, getInstant, getInt, getKeys, getKeys, getKeys, getKeys, getLong, getObject, getString, getType, toMapMethods inherited from interface com.yworkflow.definition.model.MutableAttributes
remove, remove, toImmutable
-
Constructor Details
-
AbstractMutableAttributes
public AbstractMutableAttributes()
-
-
Method Details
-
setBoolean
Description copied from interface:MutableAttributesSets a boolean attribute value.- Specified by:
setBooleanin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the boolean value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setData
Description copied from interface:MutableAttributesSets a binary data attribute value.- Specified by:
setDatain interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the byte array value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setInstant
Description copied from interface:MutableAttributesSets an Instant attribute value.- Specified by:
setInstantin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the Instant value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setDouble
Description copied from interface:MutableAttributesSets a double attribute value.- Specified by:
setDoublein interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the double value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setInt
Description copied from interface:MutableAttributesSets an integer attribute value.- Specified by:
setIntin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the integer value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setLong
Description copied from interface:MutableAttributesSets a long attribute value.- Specified by:
setLongin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the long value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setObject
Description copied from interface:MutableAttributesSets an object attribute value.- Specified by:
setObjectin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the object value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setString
Description copied from interface:MutableAttributesSets a string attribute value.- Specified by:
setStringin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- the string value to set- Throws:
AttributeException- if there's a validation error or type conflict
-
setAttributes
Description copied from interface:MutableAttributesSets all attributes from another MutableAttributes instance.- Specified by:
setAttributesin interfaceMutableAttributes- Parameters:
other- the other MutableAttributes instance to copy from- Throws:
AttributeException- if there's a validation error or type conflict
-
withBoolean
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified boolean value.- Specified by:
withBooleanin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withData
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified binary data value.- Specified by:
withDatain interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withInstant
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified Instant value.- Specified by:
withInstantin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withDouble
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified double value.- Specified by:
withDoublein interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withInt
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified integer value.- Specified by:
withIntin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withLong
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified long value.- Specified by:
withLongin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withObject
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified object value.- Specified by:
withObjectin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withString
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with the specified string value.- Specified by:
withStringin interfaceMutableAttributes- Parameters:
key- the attribute keyvalue- 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
-
withAttributes
Description copied from interface:MutableAttributesCreates a new MutableAttributes instance with all attributes from another instance.- Specified by:
withAttributesin interfaceMutableAttributes- 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
-
toString
-
setImpl
protected abstract <T> void setImpl(AttributeType<T> type, String key, T value) throws AttributeException Abstract method to set an attribute value with the specified type and key. This method must be implemented by concrete subclasses to provide the actual storage mechanism for attributes.- Type Parameters:
T- the type of the attribute value- Parameters:
type- the attribute typekey- the attribute keyvalue- the attribute value to set- Throws:
AttributeException- if there is an error setting the attribute
-
setRaw
Sets a raw attribute value by converting a string value to the specified type.- Type Parameters:
T- the type of the attribute value- Parameters:
type- the attribute typekey- the attribute keyvalue- the string value to convert and set- Throws:
AttributeException- if there is an error converting or setting the attribute
-
setRaw
Sets a raw attribute value by automatically determining the type from the value.- Parameters:
key- the attribute keyvalue- the object value to set- Throws:
AttributeException- if there is an error determining the type or setting the attribute
-