public final class Attributes extends Object
Modifier and Type | Method and Description |
---|---|
static Attribute |
emptyAttribute(AttributeDescription attributeDescription)
Returns a read-only empty attribute having the specified attribute
description.
|
static Attribute |
emptyAttribute(String attributeDescription)
Returns a read-only empty attribute having the specified attribute
description.
|
static Attribute |
renameAttribute(Attribute attribute,
AttributeDescription attributeDescription)
Returns a view of
attribute having a different attribute
description. |
static Attribute |
renameAttribute(Attribute attribute,
String attributeDescription)
Returns a view of
attribute having a different attribute
description. |
static Attribute |
singletonAttribute(AttributeDescription attributeDescription,
Object value)
Returns a read-only single-valued attribute having the specified
attribute description and value.
|
static Attribute |
singletonAttribute(String attributeDescription,
Object value)
Returns a read-only single-valued attribute having the specified
attribute description.
|
static Attribute |
unmodifiableAttribute(Attribute attribute)
Returns a read-only view of
attribute . |
static Attribute |
virtualAttribute(Attribute attribute)
Returns a view of
attribute that is virtual, i.e. |
static Attribute |
virtualAttribute(AttributeDescription attributeDescription)
Returns an empty virtual attribute.
|
static Attribute |
virtualAttribute(AttributeDescription attributeDescription,
Supplier<?> attributeValueSupplier)
Returns a virtual attribute whose values will be supplied by provided
Supplier . |
public static Attribute emptyAttribute(AttributeDescription attributeDescription)
UnsupportedOperationException
.attributeDescription
- The attribute description.NullPointerException
- If attributeDescription
was null
.public static Attribute emptyAttribute(String attributeDescription)
UnsupportedOperationException
.attributeDescription
- The attribute description.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the default schema.NullPointerException
- If attributeDescription
was null
.public static Attribute renameAttribute(Attribute attribute, AttributeDescription attributeDescription)
attribute
having a different attribute
description. All operations on the returned attribute "pass-through" to
the underlying attribute.attribute
- The attribute to be renamed.attributeDescription
- The new attribute description for attribute
.attribute
.NullPointerException
- If attribute
or attributeDescription
was
null
.public static Attribute renameAttribute(Attribute attribute, String attributeDescription)
attribute
having a different attribute
description. All operations on the returned attribute "pass-through" to
the underlying attribute. The attribute description will be decoded using
the default schema.attribute
- The attribute to be renamed.attributeDescription
- The new attribute description for attribute
.attribute
.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the default schema.NullPointerException
- If attribute
or attributeDescription
was
null
.public static Attribute singletonAttribute(AttributeDescription attributeDescription, Object value)
UnsupportedOperationException
.
If value
is not an instance of ByteString
then it will be
converted using the ByteString.valueOfObject(Object)
method.
attributeDescription
- The attribute description.value
- The single attribute value.NullPointerException
- If attributeDescription
or value
was
null
.public static Attribute singletonAttribute(String attributeDescription, Object value)
UnsupportedOperationException
.
If value
is not an instance of ByteString
then it will be
converted using the ByteString.valueOfObject(Object)
method.
attributeDescription
- The attribute description.value
- The single attribute value.LocalizedIllegalArgumentException
- If attributeDescription
could not be decoded using
the default schema.NullPointerException
- If attributeDescription
or value
was
null
.public static Attribute unmodifiableAttribute(Attribute attribute)
attribute
. Query operations on the
returned attribute "read-through" to the underlying attribute, and
attempts to modify the returned attribute either directly or indirectly
via an iterator result in an UnsupportedOperationException
.attribute
- The attribute for which a read-only view is to be returned.attribute
.NullPointerException
- If attribute
was null
.public static Attribute virtualAttribute(Attribute attribute)
attribute
that is virtual, i.e. implementations of Attribute.isVirtual()
and
Attribute.isReal()
match the semantics of virtual attributes.
Virtual attributes a special kind of attribute whose values do not actually exist in persistent storage but rather are dynamically generated in some manner.
In particular, this method can be used to implement collective virtual attribute, which is a special kind of attribute whose values do not actually exist in persistent storage but rather are obtained dynamically from applicable collective attribute subentry.
attribute
- The attribute for which a read-only view is to be returned.attribute
.NullPointerException
- If attribute
was null
.public static Attribute virtualAttribute(AttributeDescription attributeDescription, Supplier<?> attributeValueSupplier)
Supplier
.
Virtual attributes a special kind of attribute whose values do not actually exist in persistent storage but rather are dynamically generated in some manner.
In particular, this method can be used to implement collective virtual attribute, which is a special kind of attribute whose values do not actually exist in persistent storage but rather are obtained dynamically from applicable collective attribute subentry.
Note: this method should be used when computing the attribute value operation is costly. Indeed, this method returns an attribute which lazily computes the attribute value.
attributeDescription
- the attribute description of the attributeattributeValueSupplier
- The supplier that returns an attribute value for which a read-only view is to be returned.attribute
.NullPointerException
- If attribute
was null
.public static Attribute virtualAttribute(AttributeDescription attributeDescription)
Virtual attributes a special kind of attribute whose values do not actually exist in persistent storage but rather are dynamically generated in some manner.
In particular, this method can be used to implement collective virtual attribute, which is a special kind of attribute whose values do not actually exist in persistent storage but rather are obtained dynamically from applicable collective attribute subentry.
attributeDescription
- The attribute for which a read-only view is to be returned.attribute
.NullPointerException
- If attribute
was null
.Copyright 2010-2022 ForgeRock AS.