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:

  1. 'Global' default values (default values that are tied to an attribute but not to a specific metacard type)
  2. Default values that apply to specific metacard types
In the event that an attribute has a 'global' default value as well as a default value for a specific metacard type, the default value for the specific metacard type will be returned (i.e., the more specific default value wins).

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 Type
    Method
    Description
    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
    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.
  • Method Details

    • setDefaultValue

      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). Overwrites the current default value for the attribute if one exists.
      Parameters:
      attributeName - the name of the attribute, cannot be null
      defaultValue - the default value, cannot be null
      Throws:
      IllegalArgumentException - if either argument is null
    • setDefaultValue

      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. 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 null
      attributeName - the name of the attribute belonging to the metacard type, cannot be null
      defaultValue - the default value, cannot be null
      Throws:
      IllegalArgumentException - if any arguments are null
    • getDefaultValue

      Optional<Serializable> getDefaultValue(String metacardTypeName, String attributeName)
      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 null
      attributeName - the name of the attribute belonging to the metacard type, cannot be null
      Returns:
      an Optional 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 registered
      Throws:
      IllegalArgumentException - if either argument is null
    • removeDefaultValue

      void removeDefaultValue(String attributeName)
      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 - if attributeName is null
    • removeDefaultValue

      void removeDefaultValue(String metacardTypeName, String attributeName)
      Removes the default value for the given attribute of the given metacard type.
      Parameters:
      metacardTypeName - the name of the metacard type, cannot be null
      attributeName - 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

      void removeDefaultValues(String metacardTypeName)
      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 - if metacardTypeName is null