M
- The type of the Map
that will store the entry's attributes.public abstract class AbstractMapEntry<M extends Map<AttributeDescription,Attribute>> extends AbstractEntry
Map
based entries.Modifier | Constructor and Description |
---|---|
protected |
AbstractMapEntry(Dn name,
M attributes)
Creates an empty entry using the provided distinguished name and
Map . |
Modifier and Type | Method and Description |
---|---|
boolean |
addAttribute(Attribute attribute,
Collection<? super ByteString> duplicateValues)
Ensures that this entry contains the provided attribute and values (optional operation).
|
Attribute |
addAttributeIfAbsent(Attribute attribute)
Adds the provided attribute if it is not already present in this Entry and returns
null . |
Entry |
clearAttributes()
Removes all the attributes from this entry (optional operation).
|
Iterable<Attribute> |
getAllAttributes()
Returns an
Iterable containing all of the attributes in this entry. |
Attribute |
getAttribute(AttributeDescription attributeDescription)
Returns the named attribute contained in this entry, or
null if it is not included with this entry. |
int |
getAttributeCount()
Returns the number of attributes in this entry.
|
Dn |
getName()
Returns the string representation of the distinguished name of this entry.
|
Attribute |
mergeAttribute(Attribute attribute,
BiFunction<? super Attribute,? super Attribute,? extends Attribute> mergeFunction)
Adds the provided attribute if it is not already present in this Entry.
|
boolean |
removeAttribute(Attribute attribute,
Collection<? super ByteString> missingValues)
Removes all of the attribute values contained in
attribute from this entry if it is present (optional
operation). |
boolean |
replaceAttribute(Attribute attribute)
Adds all of the attribute values contained in
attribute to this entry, replacing any existing attribute
values (optional operation). |
Entry |
setName(Dn dn)
Sets the distinguished name of this entry (optional operation).
|
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAttribute, addAttribute, containsAnyAttributes, containsAnyAttributes, containsAttribute, containsAttribute, containsAttribute, getAllAttributes, getAllAttributes, getAttribute, parseAttribute, parseAttribute, removeAttribute, removeAttribute, replaceAttribute, setName
public final boolean addAttribute(Attribute attribute, Collection<? super ByteString> duplicateValues)
Entry
matching
attribute description, then this entry will be modified such that
it contains attribute
, even if it is empty.
matching
attribute description, then the attribute values contained in
attribute
will be merged with the existing attribute values.
NOTE: When attribute
is non-empty, this method implements
LDAP Modify add semantics.
attribute
- The attribute values to be added to this entry, merging with any existing attribute values.duplicateValues
- A collection into which duplicate values will be added, or null
if duplicate values should not be
saved.true
if this entry changed as a result of this call.public Attribute addAttributeIfAbsent(Attribute attribute)
Entry
null
. Otherwise
returns the existing attribute.
NOTE: this method is equivalent to Map.putIfAbsent(Object, Object)
.
attribute
- The non-null
attribute to be added if it is not already present.null
if the attribute was added, or the existing attribute (in which case the entry is
unchanged).public final Entry clearAttributes()
Entry
public final Iterable<Attribute> getAllAttributes()
Entry
Iterable
containing all of the attributes in this entry. The returned Iterable
may be
used to remove attributes if permitted by this entry.Iterable
containing all of the attributes.public final Attribute getAttribute(AttributeDescription attributeDescription)
Entry
null
if it is not included with this entry.attributeDescription
- The name of the attribute to be returned.null
if it is not included with this entry.public final int getAttributeCount()
Entry
public final Dn getName()
Entry
public Attribute mergeAttribute(Attribute attribute, BiFunction<? super Attribute,? super Attribute,? extends Attribute> mergeFunction)
Entry
null
.
NOTE: this method is equivalent to Map.merge(Object, Object, BiFunction)
.
attribute
- The non-null
attribute to be added or merged with the existing attribute.mergeFunction
- The function to recompute the attribute if it is already present in this Entry.null
if the attribute was removed.public boolean replaceAttribute(Attribute attribute)
Entry
attribute
to this entry, replacing any existing attribute
values (optional operation). If attribute
is empty then the entire attribute will be removed if it is
present.
NOTE: This method implements LDAP Modify replace semantics as described in RFC 4511 - Section 4.6. Modify Operation.
attribute
- The attribute values to be added to this entry, replacing any existing attribute values, and which may be
empty if the entire attribute is to be removed.true
if this entry changed as a result of this call.public final boolean removeAttribute(Attribute attribute, Collection<? super ByteString> missingValues)
Entry
attribute
from this entry if it is present (optional
operation). If attribute
is empty then the entire attribute will be removed if it is present.
NOTE: This method implements LDAP Modify delete semantics.
attribute
- The attribute values to be removed from this entry, which may be empty if the entire attribute is to be
removed.missingValues
- A collection into which missing values will be added, or null
if missing values should not be
saved.true
if this entry changed as a result of this call.Copyright 2010-2022 ForgeRock AS.