Interface Attributes

All Known Implementing Classes:
DefaultAttributes, LegacyAttributes

public interface Attributes

This interface wraps the attributes associated with a user profile. Different operations are provided to access and manage these attributes.

Author:
Pedro Igor
  • Field Details

    • EMPTY_VALUE

      static final List<String> EMPTY_VALUE
      Default value for attributes with no value set.
  • Method Details

    • getFirstValue

      default String getFirstValue(String name)
      Returns the first value associated with the attribute with the given .
      Parameters:
      name - the name of the attribute
      Returns:
      the first value
    • getValues

      List<String> getValues(String name)
      Returns all values for an attribute with the given name.
      Parameters:
      name - the name of the attribute
      Returns:
      the attribute values
    • isReadOnly

      boolean isReadOnly(String key)
      Checks whether an attribute is read-only.
      Parameters:
      key -
      Returns:
    • validate

      boolean validate(String name, Consumer<ValidationError>... listeners)
      Validates the attribute with the given name.
      Parameters:
      name - the name of the attribute
      listeners - the listeners for listening for errors. ValidationError.inputHint contains name of the attribute in error.
      Returns:
      true if validation is successful. Otherwise, false. In case there is no attribute with the given name, false is also returned but without triggering listeners
    • contains

      boolean contains(String name)
      Checks whether an attribute with the given name is defined.
      Parameters:
      name - the name of the attribute
      Returns:
      true if the attribute is defined. Otherwise, false
    • nameSet

      Set<String> nameSet()
      Returns the names of all defined attributes.
      Returns:
      the set of attribute names
    • getWritable

      Map<String,List<String>> getWritable()
      Returns all attributes that can be written.
      Returns:
      the attributes
    • getMetadata

      AttributeMetadata getMetadata(String name)

      Returns the metadata associated with the attribute with the given name.

      The AttributeMetadata is a copy of the original metadata. The original metadata keeps immutable.

      Parameters:
      name - the attribute name
      Returns:
      the metadata
    • isRequired

      boolean isRequired(String name)
      Returns whether the attribute with the given name is required.
      Parameters:
      name - the attribute name
      Returns:
      true if the attribute is required. Otherwise, false.
    • getReadable

      default Map<String,List<String>> getReadable(boolean includeBuiltin)
      Similar to {getReadable(boolean)} but with the possibility to add or remove the root attributes.
      Parameters:
      includeBuiltin - if the root attributes should be included.
      Returns:
      the attributes with read/write permission.
    • getReadable

      Map<String,List<String>> getReadable()
      Returns only the attributes that have read/write permissions.
      Returns:
      the attributes with read/write permission.
    • isRootAttribute

      default boolean isRootAttribute(String name)
      Returns whether the attribute with the given name is a root attribute.
      Parameters:
      name - the attribute name
      Returns:
    • toMap

      Map<String,List<String>> toMap()