Package de.xima.fc.entities.interfaces
Interface ICustomAttributeProviding
-
- All Known Subinterfaces:
ICustomAttributesEntity
- All Known Implementing Classes:
ClientFormTheme
,Mandant
,Projekt
,Textbaustein
,Vorgang
public interface ICustomAttributeProviding
Interface for object that provide custom attributes, i.e. key-value pairs that can be used to store additional information. The stored data depends on the type of the object.- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default String
getCustomAttribute(String key)
Gets the value of the attribute with the given key.default <T> T
getCustomAttributeAs(String key, Function<String,? extends T> converter)
Gets the value of the attribute with the given key.default <T> T
getCustomAttributeAs(String key, Function<String,T> converter, T defaultValue)
Gets the value of the attribute with the given key.default boolean
getCustomAttributeBoolean(String key)
Gets the value of the attribute with the given key as a boolean.default double
getCustomAttributeDouble(String key)
Gets the value of the attribute with the given key as a double.default double
getCustomAttributeDouble(String key, double defaultValue)
Gets the value of the attribute with the given key as a double.default <E extends Enum<E>>
EgetCustomAttributeEnum(String key, Class<E> enumType)
Gets the value of the attribute with the given key as an enum constant.default <E extends Enum<E>>
EgetCustomAttributeEnum(String key, Class<E> enumType, E defaultValue)
Gets the value of the attribute with the given key as an enum constant.default int
getCustomAttributeInt(String key)
Gets the value of the attribute with the given key as an integer.default int
getCustomAttributeInt(String key, int defaultValue)
Gets the value of the attribute with the given key as an integer.default com.alibaba.fastjson.JSONArray
getCustomAttributeJsonArray(String key)
Gets the value of the attribute with the given key as a JSON object.default com.alibaba.fastjson.JSONObject
getCustomAttributeJsonObject(String key)
Gets the value of the attribute with the given key as a JSON object.default long
getCustomAttributeLong(String key)
Gets the value of the attribute with the given key as a long.default long
getCustomAttributeLong(String key, long defaultValue)
Gets the value of the attribute with the given key as a long.Map<String,String>
getCustomAttributes()
Gets the map of custom attributes that may be used to store additional information.default String
getCustomAttributeString(String key)
Gets the value of the attribute with the given key as a string.default String
getCustomAttributeString(String key, String defaultValue)
Gets the value of the attribute with the given key as a string.default UUID
getCustomAttributeUuid(String key)
Gets the value of the attribute with the given key as a UUID.
-
-
-
Method Detail
-
getCustomAttribute
default String getCustomAttribute(String key)
Gets the value of the attribute with the given key.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, null if no such attribute exists.
-
getCustomAttributeAs
default <T> T getCustomAttributeAs(String key, Function<String,? extends T> converter)
Gets the value of the attribute with the given key.- Type Parameters:
T
- Type of the attribute.- Parameters:
key
- Name of the attribute.converter
- Function to parse the string attribute value.- Returns:
- The value of the attribute, null if no such attribute exists or the attribute value could not be converted to the desired type.
-
getCustomAttributeAs
default <T> T getCustomAttributeAs(String key, Function<String,T> converter, T defaultValue)
Gets the value of the attribute with the given key.- Type Parameters:
T
- Type of the attribute.- Parameters:
key
- Name of the attribute.converter
- Function to parse the string attribute value.defaultValue
- Default value to return if no value exists or the value could not be converted.- Returns:
- The value of the attribute, or the default value if no such attribute exists or the attribute value could not be converted to the desired type.
-
getCustomAttributeBoolean
default boolean getCustomAttributeBoolean(String key)
Gets the value of the attribute with the given key as a boolean.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, false if no such attribute exists.
-
getCustomAttributeDouble
default double getCustomAttributeDouble(String key)
Gets the value of the attribute with the given key as a double.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or 0 if no such attribute exists or the attribute value could not be converted to a double.
-
getCustomAttributeDouble
default double getCustomAttributeDouble(String key, double defaultValue)
Gets the value of the attribute with the given key as a double.- Parameters:
key
- Name of the attribute.defaultValue
- Default value to return if no value exists, or the value is not a valid double.- Returns:
- The value of the attribute, or the default value if no such attribute exists or the attribute value could not be converted to a double.
-
getCustomAttributeEnum
default <E extends Enum<E>> E getCustomAttributeEnum(String key, Class<E> enumType)
Gets the value of the attribute with the given key as an enum constant.- Type Parameters:
E
- Type of the enum.- Parameters:
key
- Name of the attribute.enumType
- Type of the enum.- Returns:
- The value of the attribute, or 0 if no such attribute exists or the attribute value could not be converted to an enum constant.
-
getCustomAttributeEnum
default <E extends Enum<E>> E getCustomAttributeEnum(String key, Class<E> enumType, E defaultValue)
Gets the value of the attribute with the given key as an enum constant.- Type Parameters:
E
- Type of the enum.- Parameters:
key
- Name of the attribute.enumType
- Type of the enum.defaultValue
- Default value to return if no value exists, or the value is not a valid enum constant.- Returns:
- The value of the attribute, or the default value if no such attribute exists or the attribute value could not be converted to an enum constant.
-
getCustomAttributeInt
default int getCustomAttributeInt(String key)
Gets the value of the attribute with the given key as an integer.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or 0 if no such attribute exists or the attribute value could not be converted to an integer.
-
getCustomAttributeInt
default int getCustomAttributeInt(String key, int defaultValue)
Gets the value of the attribute with the given key as an integer.- Parameters:
key
- Name of the attribute.defaultValue
- Default value to return if no value exists, or the value is not a valid integer.- Returns:
- The value of the attribute, or the default value if no such attribute exists or the attribute value could not be converted to an integer.
-
getCustomAttributeJsonArray
default com.alibaba.fastjson.JSONArray getCustomAttributeJsonArray(String key)
Gets the value of the attribute with the given key as a JSON object.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or empty JSON object if no such attribute exists or the attribute value could not be parsed as a JSON object.
-
getCustomAttributeJsonObject
default com.alibaba.fastjson.JSONObject getCustomAttributeJsonObject(String key)
Gets the value of the attribute with the given key as a JSON object.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or empty JSON object if no such attribute exists or the attribute value could not be parsed as a JSON object.
-
getCustomAttributeLong
default long getCustomAttributeLong(String key)
Gets the value of the attribute with the given key as a long.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or 0 if no such attribute exists or the attribute value could not be converted to a long.
-
getCustomAttributeLong
default long getCustomAttributeLong(String key, long defaultValue)
Gets the value of the attribute with the given key as a long.- Parameters:
key
- Name of the attribute.defaultValue
- Default value to return if no value exists, or the value is not a valid long.- Returns:
- The value of the attribute, or the default value if no such attribute exists or the attribute value could not be converted to a long.
-
getCustomAttributeString
default String getCustomAttributeString(String key)
Gets the value of the attribute with the given key as a string.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or empty string if no such attribute exists.
-
getCustomAttributeString
default String getCustomAttributeString(String key, String defaultValue)
Gets the value of the attribute with the given key as a string.- Parameters:
key
- Name of the attribute.defaultValue
- Default value to return if no value exists.- Returns:
- The value of the attribute, or the default value if no such attribute exists, or the attribute value is empty.
-
getCustomAttributeUuid
default UUID getCustomAttributeUuid(String key)
Gets the value of the attribute with the given key as a UUID.- Parameters:
key
- Name of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists or the attribute value could not be parsed as a UUID.
-
-