Package ddf.catalog.data
Interface DefaultAttributeValueRegistry
public interface DefaultAttributeValueRegistry
Manages default attribute values that apply to all metacard types and default attribute values
that apply to specific metacard types.
Default attribute values are separated into two categories:
- 'Global' default values (default values that are tied to an attribute but not to a specific metacard type)
- Default values that apply to specific metacard types
This code is experimental. While this interface is functional and tested, it may change or be removed in a future version of the library.
-
Method Summary
Modifier and TypeMethodDescriptiongetDefaultValue(String metacardTypeName, String attributeName) Retrieves the default value registered for the given attribute of the given metacard type.voidremoveDefaultValue(String attributeName) Removes the default value for the given attribute.voidremoveDefaultValue(String metacardTypeName, String attributeName) Removes the default value for the given attribute of the given metacard type.voidRemoves all 'global' default values (i.e., the default values for the attributes that are not tied to specific metacard types).voidremoveDefaultValues(String metacardTypeName) Removes all the default attribute values for the given metacard type.voidsetDefaultValue(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).voidsetDefaultValue(String metacardTypeName, String attributeName, Serializable defaultValue) Registers the given value as the default value for the given attribute of the given metacard type.
-
Method Details
-
setDefaultValue
Registers the given value as the default value for the given attribute across all metacard types (i.e., it is a 'global' default value). Overwrites the current default value for the attribute if one exists.- Parameters:
attributeName- the name of the attribute, cannot be nulldefaultValue- the default value, cannot be null- Throws:
IllegalArgumentException- if either argument is null
-
setDefaultValue
Registers the given value as the default value for the given attribute of the given metacard type. Overwrites the current default value for the given metacard type-attribute pair if one exists.- Parameters:
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 null- Throws:
IllegalArgumentException- if any arguments are null
-
getDefaultValue
Retrieves the default value registered for the given attribute of the given metacard type.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.
- Parameters:
metacardTypeName- the name of the metacard type, cannot be nullattributeName- the name of the attribute belonging to the metacard type, cannot be null- Returns:
- an
Optionalcontaining the default value registered for the given attribute of the given metacard type, orOptional.empty()if the attribute does not have a default value registered - Throws:
IllegalArgumentException- if either argument is null
-
removeDefaultValue
Removes the default value for the given attribute.- Parameters:
attributeName- the name of the attribute whose default value will be removed, cannot be null- Throws:
IllegalArgumentException- ifattributeNameis null
-
removeDefaultValue
Removes the default value for the given attribute of the given metacard type.- Parameters:
metacardTypeName- the name of the metacard type, cannot be nullattributeName- the name of the attribute whose default value will be removed, cannot be null- Throws:
IllegalArgumentException- if either argument is null
-
removeDefaultValues
void removeDefaultValues()Removes all 'global' default values (i.e., the default values for the attributes that are not tied to specific metacard types). -
removeDefaultValues
Removes all the default attribute values for the given metacard type.- Parameters:
metacardTypeName- the name of the metacard type whose default attribute values will be removed, cannot be null- Throws:
IllegalArgumentException- ifmetacardTypeNameis null
-