public interface Attributes
This interface wraps the attributes associated with a user profile. Different operations are provided to access and manage these attributes.
Modifier and Type | Field and Description |
---|---|
static List<String> |
EMPTY_VALUE
Default value for attributes with no value set.
|
Modifier and Type | Method and Description |
---|---|
Set<Map.Entry<String,List<String>>> |
attributeSet()
Returns all attributes defined.
|
boolean |
contains(String name)
Checks whether an attribute with the given
name is defined. |
default String |
getFirstValue(String name)
Returns the first value associated with the attribute with the given .
|
AttributeMetadata |
getMetadata(String name)
Returns the metadata associated with the attribute with the given
name . |
Map<String,List<String>> |
getReadable()
Returns only the attributes that have read/write permissions.
|
default Map<String,List<String>> |
getReadable(boolean includeBuiltin)
Similar to {
getReadable(boolean) } but with the possibility to add or remove
the root attributes. |
List<String> |
getValues(String name)
Returns all values for an attribute with the given
name . |
boolean |
isReadOnly(String key)
Checks whether an attribute is read-only.
|
boolean |
isRequired(String name)
Returns whether the attribute with the given
name is required. |
default boolean |
isRootAttribute(String name)
Returns whether the attribute with the given
name is a root attribute. |
Set<String> |
nameSet()
Returns the names of all defined attributes.
|
Map<String,List<String>> |
toMap() |
boolean |
validate(String name,
Consumer<ValidationError>... listeners)
Validates the attribute with the given
name . |
default String getFirstValue(String name)
name
- the name of the attributeList<String> getValues(String name)
name
.name
- the name of the attributeboolean isReadOnly(String key)
key
- boolean validate(String name, Consumer<ValidationError>... listeners)
name
.name
- the name of the attributelisteners
- the listeners for listening for errors. ValidationError.inputHint
contains name of the attribute in error.true
if validation is successful. Otherwise, false
. In case there is no attribute with the given name
,
false
is also returned but without triggering listenersboolean contains(String name)
name
is defined.name
- the name of the attributetrue
if the attribute is defined. Otherwise, false
Set<String> nameSet()
Set<Map.Entry<String,List<String>>> attributeSet()
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.
name
- the attribute nameboolean isRequired(String name)
name
is required.name
- the attribute nametrue
if the attribute is required. Otherwise, false
.default Map<String,List<String>> getReadable(boolean includeBuiltin)
getReadable(boolean)
} but with the possibility to add or remove
the root attributes.includeBuiltin
- if the root attributes should be included.Map<String,List<String>> getReadable()
default boolean isRootAttribute(String name)
name
is a root attribute.name
- the attribute nameCopyright © 2021 JBoss by Red Hat. All rights reserved.