Class AbstractAttributes
java.lang.Object
com.yworkflow.definition.model.attribute.AbstractAttributes
- All Implemented Interfaces:
Attributes
- Direct Known Subclasses:
AbstractMutableAttributes
Abstract base class for attribute collections. AbstractAttributes provides a common
implementation for the Attributes interface, handling type conversion and delegation to concrete
implementations.
- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract <T> Optional<T>get(AttributeType<T> type, String key) Abstract method to get an attribute value with the specified type and key.Gets an attribute value as an Object.getBoolean(String key) Gets a boolean attribute value.Optional<byte[]>Gets a binary data attribute value.Gets a double attribute value.getInstant(String key) Gets an Instant attribute value.Gets an integer attribute value.getKeys()Gets all attribute keys.getKeys(AttributeType<?> type) Gets all attribute keys of the specified type.Gets all attribute keys with the specified prefix.Gets a long attribute value.Gets an object attribute value.Gets a string attribute value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yworkflow.definition.model.attribute.Attributes
containsKey, getEntry, getKeys, getType, toMap
-
Constructor Details
-
AbstractAttributes
public AbstractAttributes()
-
-
Method Details
-
get
Description copied from interface:AttributesGets an attribute value as an Object. This method returns the raw value without type checking.- Specified by:
getin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the attribute value if found, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getBoolean
Description copied from interface:AttributesGets a boolean attribute value.- Specified by:
getBooleanin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the boolean value if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getData
Description copied from interface:AttributesGets a binary data attribute value.- Specified by:
getDatain interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the byte array if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getInstant
Description copied from interface:AttributesGets an Instant attribute value.- Specified by:
getInstantin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the Instant if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getDouble
Description copied from interface:AttributesGets a double attribute value.- Specified by:
getDoublein interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the double value if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getInt
Description copied from interface:AttributesGets an integer attribute value.- Specified by:
getIntin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the integer value if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getKeys
Description copied from interface:AttributesGets all attribute keys.- Specified by:
getKeysin interfaceAttributes- Returns:
- a collection of all attribute keys
- Throws:
AttributeException- if there's an error accessing the attributes
-
getKeys
Description copied from interface:AttributesGets all attribute keys of the specified type.- Specified by:
getKeysin interfaceAttributes- Parameters:
type- the attribute type to filter by- Returns:
- a collection of keys for attributes of the specified type
- Throws:
AttributeException- if there's an error accessing the attributes
-
getKeys
Description copied from interface:AttributesGets all attribute keys with the specified prefix.- Specified by:
getKeysin interfaceAttributes- Parameters:
prefix- the prefix to filter by- Returns:
- a collection of keys that start with the specified prefix
- Throws:
AttributeException- if there's an error accessing the attributes
-
getLong
Description copied from interface:AttributesGets a long attribute value.- Specified by:
getLongin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the long value if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getObject
Description copied from interface:AttributesGets an object attribute value.- Specified by:
getObjectin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the object value if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
getString
Description copied from interface:AttributesGets a string attribute value.- Specified by:
getStringin interfaceAttributes- Parameters:
key- the attribute key- Returns:
- an Optional containing the string value if found and type matches, empty otherwise
- Throws:
AttributeException- if there's an error accessing the attribute
-
get
Abstract method to get 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 key- Returns:
- an Optional containing the attribute value if found
- Throws:
AttributeException- if there is an error retrieving the attribute
-