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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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.Map<String,Object>getAttributes()Gets a map of additional custom attributes associated with this object.default BooleangetBooleanAttribute(String key)Gets 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 LonggetIntegerAttribute(String key)Gets 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.SelfwithAddedAttribute(String key, Object value)Gets a new instance with the attribute at the given key changed to the given value.SelfwithAddedAttributes(Map<String,Object> attributes)Gets a new instance with the attributes changed to the given map of attributes.SelfwithAttributes(Map<String,Object> attributes)Gets a new instance with the attributes changed to the given map of attributes.
-
-
-
Method Detail
-
getAttribute
default Object getAttribute(String key)
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
default <T> T getAttribute(String key, Class<T> type)
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
Map<String,Object> getAttributes()
Gets a map of additional custom attributes associated with this object. The exact meaning of these attributes is up to the user of the API.- Returns:
- A map of additional attributes associated with this object.
-
getBooleanAttribute
default Boolean getBooleanAttribute(String key)
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
default boolean getBooleanAttribute(String key, boolean defaultValue)
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
default Double getFloatAttribute(String key)
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
default double getFloatAttribute(String key, double defaultValue)
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
default Long getIntegerAttribute(String key)
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
default long getIntegerAttribute(String key, long defaultValue)
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
default String getStringAttribute(String key)
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
default String getStringAttribute(String key, String defaultValue)
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
Self withAddedAttribute(String key, Object value)
Gets a new instance with the attribute at the given key changed to the given value.- Parameters:
key- The attribute key.value- The attribute value.- Returns:
- A new instance with the new attribute.
-
withAddedAttributes
Self withAddedAttributes(Map<String,Object> attributes)
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.
-
-