public interface DefaultAttributeValueRegistry
Default attribute values are separated into two categories:
This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.
Modifier and Type | Method and Description |
---|---|
Optional<Serializable> |
getDefaultValue(String metacardTypeName,
String attributeName)
Retrieves the default value registered for the given attribute of the given metacard type.
|
void |
removeDefaultValue(String attributeName)
Removes the default value for the given attribute.
|
void |
removeDefaultValue(String metacardTypeName,
String attributeName)
Removes the default value for the given attribute of the given metacard type.
|
void |
removeDefaultValues()
Removes all 'global' default values (i.e., the default values for the attributes that are not
tied to specific metacard types).
|
void |
removeDefaultValues(String metacardTypeName)
Removes all the default attribute values for the given metacard type.
|
void |
setDefaultValue(String attributeName,
Serializable defaultValue)
Registers the given value as the default value for the given attribute across all metacard
types (i.e., it is a 'global' default value).
|
void |
setDefaultValue(String metacardTypeName,
String attributeName,
Serializable defaultValue)
Registers the given value as the default value for the given attribute of the given metacard
type.
|
void setDefaultValue(String attributeName, Serializable defaultValue)
attributeName
- the name of the attribute, cannot be nulldefaultValue
- the default value, cannot be nullIllegalArgumentException
- if either argument is nullvoid setDefaultValue(String metacardTypeName, String attributeName, Serializable defaultValue)
metacardTypeName
- the name of the metacard type, cannot be nullattributeName
- the name of the attribute belonging to the metacard type, cannot be nulldefaultValue
- the default value, cannot be nullIllegalArgumentException
- if any arguments are nullOptional<Serializable> getDefaultValue(String metacardTypeName, String attributeName)
In the event that an attribute has a 'global' default value as well as a default value for the given metacard type, the default value for the given metacard type will be returned (i.e., the more specific default value wins). If the attribute has a 'global' default value but no default value for the given metacard type, then the 'global' default value will be returned.
metacardTypeName
- the name of the metacard type, cannot be nullattributeName
- the name of the attribute belonging to the metacard type, cannot be nullOptional
containing the default value registered for the given attribute of
the given metacard type, or Optional.empty()
if the attribute does not have a
default value registeredIllegalArgumentException
- if either argument is nullvoid removeDefaultValue(String attributeName)
attributeName
- the name of the attribute whose default value will be removed, cannot be
nullIllegalArgumentException
- if attributeName
is nullvoid removeDefaultValue(String metacardTypeName, String attributeName)
metacardTypeName
- the name of the metacard type, cannot be nullattributeName
- the name of the attribute whose default value will be removed, cannot be
nullIllegalArgumentException
- if either argument is nullvoid removeDefaultValues()
void removeDefaultValues(String metacardTypeName)
metacardTypeName
- the name of the metacard type whose default attribute values will be
removed, cannot be nullIllegalArgumentException
- if metacardTypeName
is nullThis work is licensed under a Creative Commons Attribution 4.0 International License.