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, toString
isEmpty, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
spliterator
parallelStream, removeIf, stream
public 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.valueOfObject(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.valueOfObject(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.valueOfObject(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.valueOfObject(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.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 LinkedAttribute(String attributeDescription, Object... values)
Any attribute values which are not instances of ByteString
will
be converted using the ByteString.valueOfObject(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)
Attribute
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 Attribute
add
in class AbstractAttribute
value
- The attribute value to be added to this attribute.true
if this attribute changed as a result of this call.public void clear()
Attribute
clear
in interface Collection<ByteString>
clear
in interface Set<ByteString>
clear
in interface Attribute
clear
in class AbstractCollection<ByteString>
public boolean contains(Object value)
Attribute
true
if this attribute contains value
.
If value
is not an instance of ByteString
then it will be
converted using the ByteString.valueOfObject(Object)
method.
contains
in interface Collection<ByteString>
contains
in interface Set<ByteString>
contains
in interface Attribute
contains
in class AbstractAttribute
value
- 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)
Attribute
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.valueOfObject(Object)
method.
containsAll
in interface Collection<ByteString>
containsAll
in interface Set<ByteString>
containsAll
in interface Attribute
containsAll
in class AbstractAttribute
values
- 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()
Attribute
firstValue
in interface Attribute
firstValue
in class AbstractAttribute
public AttributeDescription getAttributeDescription()
Attribute
getAttributeDescription
in interface Attribute
getAttributeDescription
in class AbstractAttribute
public Iterator<ByteString> iterator()
Attribute
iterator
in interface Iterable<ByteString>
iterator
in interface Collection<ByteString>
iterator
in interface Set<ByteString>
iterator
in interface Attribute
iterator
in class AbstractAttribute
public boolean remove(Object value)
Attribute
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.valueOfObject(Object)
method.
remove
in interface Collection<ByteString>
remove
in interface Set<ByteString>
remove
in interface Attribute
remove
in class AbstractAttribute
value
- 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)
Attribute
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.valueOfObject(Object)
method.
retainAll
in interface Attribute
retainAll
in class AbstractAttribute
T
- 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()
Attribute
size
in interface Collection<ByteString>
size
in interface Set<ByteString>
size
in interface Attribute
size
in class AbstractAttribute
Copyright 2010-2020 ForgeRock AS.