public final class LinkedAttribute extends AbstractAttribute
Attribute interface with predictable
iteration order.
Internally, attribute values are stored in a linked list and it's this list which defines the iteration ordering, which is the order in which elements were inserted into the set (insertion-order). This ordering is particularly useful in LDAP where clients generally appreciate having things returned in the same order they were presented.
All operations are supported by this implementation.
| Modifier and Type | Field and Description |
|---|---|
static AttributeFactory |
FACTORY
An attribute factory which can be used to create new linked attributes.
|
| Constructor and Description |
|---|
LinkedAttribute(Attribute attribute)
Creates a new attribute having the same attribute description and
attribute values as
attribute. |
LinkedAttribute(AttributeDescription attributeDescription)
Creates a new attribute having the specified attribute description and no
attribute values.
|
LinkedAttribute(AttributeDescription attributeDescription,
Collection<?> values)
Creates a new attribute having the specified attribute description and
attribute values.
|
LinkedAttribute(AttributeDescription attributeDescription,
Object... values)
Creates a new attribute having the specified attribute description and
attribute values.
|
LinkedAttribute(AttributeDescription attributeDescription,
Object value)
Creates a new attribute having the specified attribute description and
single attribute value.
|
LinkedAttribute(String attributeDescription)
Creates a new attribute having the specified attribute description and no
attribute values.
|
LinkedAttribute(String attributeDescription,
Collection<?> values)
Creates a new attribute having the specified attribute description and
attribute values.
|
LinkedAttribute(String attributeDescription,
Object... values)
Creates a new attribute having the specified attribute description and
attribute values.
|
LinkedAttribute(String attributeDescription,
Object value)
Creates a new attribute having the specified attribute description and
single attribute value.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(ByteString value)
Adds
value to this attribute if it is not already present
(optional operation). |
void |
clear()
Removes all of the attribute values from this attribute (optional
operation).
|
boolean |
contains(Object value)
Returns
true if this attribute contains value. |
boolean |
containsAll(Collection<?> values)
Returns
true if this attribute contains all of the attribute
values contained in values. |
ByteString |
firstValue()
Returns the first attribute value in this attribute.
|
AttributeDescription |
getAttributeDescription()
Returns the attribute description of this attribute, which includes its
attribute type and any options.
|
Iterator<ByteString> |
iterator()
Returns an iterator over the attribute values in this attribute.
|
boolean |
remove(Object value)
Removes
value from this attribute if it is present (optional
operation). |
<T> boolean |
retainAll(Collection<T> values,
Collection<? super T> missingValues)
Retains only the attribute values in this attribute which are contained
in
values (optional operation). |
int |
size()
Returns the number of attribute values in this attribute.
|
add, addAll, addAll, equals, firstValueAsString, getAttributeDescriptionAsString, hashCode, parse, removeAll, removeAll, retainAll, toArray, toStringisEmpty, toArraypublic static final AttributeFactory FACTORY
public LinkedAttribute(Attribute attribute)
attribute.attribute - The attribute to be copied.NullPointerException - If attribute was null.public LinkedAttribute(AttributeDescription attributeDescription)
attributeDescription - The attribute description.NullPointerException - If attributeDescription was null.public LinkedAttribute(AttributeDescription attributeDescription, Object value)
If value is not an instance of ByteString then it will be
converted using the ByteString.valueOf(Object) method.
attributeDescription - The attribute description.value - The single attribute value.NullPointerException - If attributeDescription or value was
null .public LinkedAttribute(AttributeDescription attributeDescription, Object... values)
Any attribute values which are not instances of ByteString will
be converted using the ByteString.valueOf(Object) method.
attributeDescription - The attribute description.values - The attribute values.NullPointerException - If attributeDescription or values was
null.public LinkedAttribute(AttributeDescription attributeDescription, Collection<?> values)
Any attribute values which are not instances of ByteString will
be converted using the ByteString.valueOf(Object) method.
attributeDescription - The attribute description.values - The attribute values.NullPointerException - If attributeDescription or values was
null.public LinkedAttribute(String attributeDescription)
attributeDescription - The attribute description.LocalizedIllegalArgumentException - If attributeDescription could not be decoded using
the default schema.NullPointerException - If attributeDescription was null.public LinkedAttribute(String attributeDescription, Collection<?> values)
Any attribute values which are not instances of ByteString will
be converted using the ByteString.valueOf(Object) method.
attributeDescription - The attribute description.values - The attribute values.LocalizedIllegalArgumentException - If attributeDescription could not be decoded using
the default schema.NullPointerException - If attributeDescription or values was
null.public LinkedAttribute(String attributeDescription, Object value)
If value is not an instance of ByteString then it will be
converted using the ByteString.valueOf(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 LinkedAttribute(String attributeDescription, Object... values)
Any attribute values which are not instances of ByteString will
be converted using the ByteString.valueOf(Object) method.
attributeDescription - The attribute description.values - The attribute values.LocalizedIllegalArgumentException - If attributeDescription could not be decoded using
the default schema.NullPointerException - If attributeDescription or values was
null.public boolean add(ByteString value)
value to this attribute if it is not already present
(optional operation). If this attribute already contains value,
the call leaves the attribute unchanged and returns false.add in interface Collection<ByteString>add in interface Set<ByteString>add in interface Attributeadd in class AbstractAttributevalue - The attribute value to be added to this attribute.true if this attribute changed as a result of this call.public void clear()
clear in interface Collection<ByteString>clear in interface Set<ByteString>clear in interface Attributeclear in class AbstractCollection<ByteString>public boolean contains(Object value)
true if this attribute contains value.
If value is not an instance of ByteString then it will be
converted using the ByteString.valueOf(Object) method.
contains in interface Collection<ByteString>contains in interface Set<ByteString>contains in interface Attributecontains in class AbstractAttributevalue - The attribute value whose presence in this attribute is to be
tested.true if this attribute contains value, or
false if not.public boolean containsAll(Collection<?> values)
true if this attribute contains all of the attribute
values contained in values.
Any attribute values which are not instances of ByteString will
be converted using the ByteString.valueOf(Object) method.
containsAll in interface Collection<ByteString>containsAll in interface Set<ByteString>containsAll in interface AttributecontainsAll in class AbstractAttributevalues - The attribute values whose presence in this attribute is to be
tested.true if this attribute contains all of the attribute
values contained in values, or false if not.public ByteString firstValue()
firstValue in interface AttributefirstValue in class AbstractAttributepublic AttributeDescription getAttributeDescription()
getAttributeDescription in interface AttributegetAttributeDescription in class AbstractAttributepublic Iterator<ByteString> iterator()
iterator in interface Iterable<ByteString>iterator in interface Collection<ByteString>iterator in interface Set<ByteString>iterator in interface Attributeiterator in class AbstractAttributepublic boolean remove(Object value)
value from this attribute if it is present (optional
operation). If this attribute does not contain value, the call
leaves the attribute unchanged and returns false.
If value is not an instance of ByteString then it will be
converted using the ByteString.valueOf(Object) method.
remove in interface Collection<ByteString>remove in interface Set<ByteString>remove in interface Attributeremove in class AbstractAttributevalue - The attribute value to be removed from this attribute.true if this attribute changed as a result of this call.public <T> boolean retainAll(Collection<T> values, Collection<? super T> missingValues)
values (optional operation). Any attribute values which are
not already present will be added to missingValues if specified.
Any attribute values which are not instances of ByteString will
be converted using the ByteString.valueOf(Object) method.
retainAll in interface AttributeretainAll in class AbstractAttributeT - The type of the attribute value objects being retained.values - The attribute values to be retained in this attribute.missingValues - A collection into which missing values will be added, or
null if missing values should not be saved.true if this attribute changed as a result of this call.public int size()
size in interface Collection<ByteString>size in interface Set<ByteString>size in interface Attributesize in class AbstractAttributeCopyright © 2011-2015 ForgeRock AS. All Rights Reserved.