Interface IAttributeConfigurable<Self>
- All Known Subinterfaces:
IAnyValueDescriptor, IBooleanValueDescriptor, IConstValueDescriptor<V>, IFileListDescriptor, IFileValueDescriptor, IFloatValueDescriptor, IIntegerValueDescriptor, ILargeStringValueDescriptor, IListValueDescriptor<V>, IMapValueDescriptor<V>, INullValueDescriptor, IProperty, IRecordValueDescriptor, IStringValueDescriptor, ITupleValueDescriptor, IUnionValueDescriptor, IValueDescriptor<Value,Builder>, IVoidValueDescriptor
- All Known Implementing Classes:
AttachmentDescriptor, FileItemDescriptor, FileListDescriptor, FileValueDescriptor, FormRecordChatDescriptor, FormRecordMessageDescriptor, FormRecordMessageUploadRequestDescriptor, MimeTypeDescriptor, RecordValueDescriptorWrapper, UserDataDescriptor, UserProfileDescriptor
public interface IAttributeConfigurable<Self>
An interface for objects that can have custom attributes associated with them. The exact meaning of these attributes
is up to the user of the value descriptor API.
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault ObjectgetAttribute(String key) Gets a custom string attribute associated with a certain key.default <T> TgetAttribute(String key, Class<T> type) Gets a custom string attribute associated with a certain key, if it is of a certain type.Gets a map of additional custom attributes associated with this object.default BooleanGets a custom boolean attribute associated with a certain key.default booleangetBooleanAttribute(String key, boolean defaultValue) Gets a custom boolean attribute associated with a certain key.default DoublegetFloatAttribute(String key) Gets a custom floating point number attribute associated with a certain key.default doublegetFloatAttribute(String key, double defaultValue) Gets a custom floating point number attribute associated with a certain key.default LongGets a custom integer attribute associated with a certain key.default longgetIntegerAttribute(String key, long defaultValue) Gets a custom integer attribute associated with a certain key.default StringgetStringAttribute(String key) Gets a custom string attribute associated with a certain key.default StringgetStringAttribute(String key, String defaultValue) Gets a custom string attribute associated with a certain key.withAddedAttribute(String key, Object value) Gets a new instance with the attribute at the given key changed to the given value.withAddedAttributes(Map<String, Object> attributes) Gets a new instance with the attributes changed to the given map of attributes.withAttributes(Map<String, Object> attributes) Gets a new instance with the attributes changed to the given map of attributes.
-
Method Details
-
getAttribute
Gets a custom string attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists.
-
getAttribute
Gets a custom string attribute associated with a certain key, if it is of a certain type. The exact meaning of these attributes is up to the user of the value descriptor API.- Type Parameters:
T- The expected type of the attribute.- Parameters:
key- The key of the attribute.type- The expected type of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists or its value is not of the expected type.
-
getAttributes
-
getBooleanAttribute
Gets a custom boolean attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists or its value is not a boolean.
-
getBooleanAttribute
Gets a custom boolean attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.defaultValue- The default value to return if no such attribute exists or its value is not a boolean.- Returns:
- The value of the attribute, or the default value if no such attribute exists or its value is not a boolean.
-
getFloatAttribute
Gets a custom floating point number attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists or its value is not a floating point number.
-
getFloatAttribute
Gets a custom floating point number attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.defaultValue- The default value to return if no such attribute exists or its value is not a floating point number.- Returns:
- The value of the attribute, or the default if no such attribute exists or its value is not a floating point number.
-
getIntegerAttribute
Gets a custom integer attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists or its value is not an integer.
-
getIntegerAttribute
Gets a custom integer attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.defaultValue- The default value to return if no such attribute exists or its value is not an integer.- Returns:
- The value of the attribute, or the default value if no such attribute exists or its value is not an integer.
-
getStringAttribute
Gets a custom string attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.- Returns:
- The value of the attribute, or null if no such attribute exists or its value is not a string.
-
getStringAttribute
Gets a custom string attribute associated with a certain key. The exact meaning of these attributes is up to the user of the value descriptor API.- Parameters:
key- The key of the attribute.defaultValue- The default value to return if no such attribute exists or its value is not a string.- Returns:
- The value of the attribute, or the default value if no such attribute exists or its value is not a string.
-
withAddedAttribute
-
withAddedAttributes
Gets a new instance with the attributes changed to the given map of attributes. Preserves other existing attributes and only adds or replaces the given ones.- Parameters:
attributes- The new attributes to add (or replace).- Returns:
- A new instance with the current attributes plus the given attributes.
-
withAttributes
-