Package com.yworkflow.definition.model
Interface Attributes
- All Known Subinterfaces:
MutableAttributes
- All Known Implementing Classes:
EmptyAttributes
public interface Attributes
Base interface for accessing workflow attributes. Attributes represent the data associated with
workflow instances and can include various types of information such as user inputs, computed
values, and system metadata.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Checks if an attribute with the specified key exists.static Attributesempty()Creates a new empty ImmutableAttributes instance.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.Gets the complete attribute entry for a key.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.getKeys(String prefix, AttributeType<?> type) Gets all attribute keys with the specified prefix and type.Gets a long attribute value.Gets an object attribute value.Gets a string attribute value.Gets the type of attribute.toMap()Converts this Attributes instance to a Map representation.
-
Method Details
-
get
Gets an attribute value as an Object. This method returns the raw value without type checking.- Parameters:
key- the attribute key- Returns:
- an Optional containing the attribute value if found, empty otherwise
-
getBoolean
Gets a boolean attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the boolean value if found and type matches, empty otherwise
-
getData
Gets a binary data attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the byte array if found and type matches, empty otherwise
-
getInstant
Gets an Instant attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the Instant if found and type matches, empty otherwise
-
getDouble
Gets a double attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the double value if found and type matches, empty otherwise
-
getInt
Gets an integer attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the integer value if found and type matches, empty otherwise
-
getKeys
Collection<String> getKeys()Gets all attribute keys.- Returns:
- a collection of all attribute keys
-
getKeys
Gets all attribute keys of the specified type.- Parameters:
type- the attribute type to filter by- Returns:
- a collection of keys for attributes of the specified type
-
getKeys
Gets all attribute keys with the specified prefix.- Parameters:
prefix- the prefix to filter by- Returns:
- a collection of keys that start with the specified prefix
-
getKeys
Gets all attribute keys with the specified prefix and type.- Parameters:
prefix- the prefix to filter bytype- the attribute type to filter by- Returns:
- a collection of keys that start with the prefix and are of the specified type
-
getLong
Gets a long attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the long value if found and type matches, empty otherwise
-
getObject
Gets an object attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the object value if found and type matches, empty otherwise
-
getString
Gets a string attribute value.- Parameters:
key- the attribute key- Returns:
- an Optional containing the string value if found and type matches, empty otherwise
-
getType
Gets the type of attribute.- Parameters:
key- the attribute key- Returns:
- an Optional containing the attribute type if the key exists, empty otherwise
-
getEntry
Gets the complete attribute entry for a key.- Parameters:
key- the attribute key- Returns:
- an Optional containing the attribute entry if found, empty otherwise
-
containsKey
Checks if an attribute with the specified key exists.- Parameters:
key- the attribute key to check- Returns:
- true if the key exists, false otherwise
-
toMap
Converts this Attributes instance to a Map representation. Only attributes with non-null values are included in the resulting map.- Returns:
- a Map containing the attribute key-value pairs
-
empty
Creates a new empty ImmutableAttributes instance.- Returns:
- a new empty ImmutableAttributes instance
-