Package org.forgerock.opendj.ldap
Class LinkedHashMapEntry
java.lang.Object
org.forgerock.opendj.ldap.AbstractEntry
org.forgerock.opendj.ldap.AbstractMapEntry<LinkedHashMap<AttributeDescription,Attribute>>
org.forgerock.opendj.ldap.LinkedHashMapEntry
- All Implemented Interfaces:
Entry
public final class LinkedHashMapEntry
extends AbstractMapEntry<LinkedHashMap<AttributeDescription,Attribute>>
An implementation of the
Entry interface which uses a LinkedHashMap for storing attributes.
Attributes are returned in the same order that they were added to the entry. All operations are supported by this
implementation. For example, you can build an entry like this:
Entry entry = new LinkedHashMapEntry("cn=Bob,ou=People,dc=example,dc=com")
.addAttribute("cn", "Bob")
.addAttribute("objectclass", "top")
.addAttribute("objectclass", "person")
.addAttribute("objectclass", "organizationalPerson")
.addAttribute("objectclass", "inetOrgPerson")
.addAttribute("mail", "subgenius@example.com")
.addAttribute("sn", "Dobbs");
A LinkedHashMapEntry stores references to attributes which have been added using the AbstractMapEntry.addAttribute(org.forgerock.opendj.ldap.Attribute, java.util.Collection<? super org.forgerock.opendj.ldap.ByteString>)
methods. Attributes sharing the same attribute description are merged by adding the values of the new attribute to
the existing attribute. More specifically, the existing attribute must be modifiable for the merge to succeed.
Similarly, the AbstractMapEntry.removeAttribute(org.forgerock.opendj.ldap.Attribute, java.util.Collection<? super org.forgerock.opendj.ldap.ByteString>) methods remove the specified values from the existing attribute. The AbstractMapEntry.replaceAttribute(org.forgerock.opendj.ldap.Attribute) methods remove the existing attribute (if present) and store a reference to the new attribute -
neither the new or existing attribute need to be modifiable in this case.-
Constructor Summary
ConstructorsConstructorDescriptionCreates an entry with an empty (root) distinguished name and no attributes.LinkedHashMapEntry(String name) Creates an empty entry using the provided distinguished name decoded using the default schema.LinkedHashMapEntry(String... ldifLines) Creates a new entry using the provided lines of LDIF decoded using the default schema.LinkedHashMapEntry(Dn name) Creates an empty entry using the provided distinguished name and no attributes. -
Method Summary
Modifier and TypeMethodDescriptionstatic LinkedHashMapEntrydeepCopyOfEntry(Entry entry) Creates an entry having the same distinguished name, attributes, and object classes of the provided entry.static LinkedHashMapEntryshallowCopyOfEntry(Entry entry) Creates an entry having the same distinguished name, attributes, and object classes of the provided entry.Methods inherited from class org.forgerock.opendj.ldap.AbstractMapEntry
addAttribute, addAttributeIfAbsent, clearAttributes, getAllAttributes, getAttribute, getAttributeCount, getName, mergeAttribute, removeAttribute, replaceAttribute, setNameMethods inherited from class org.forgerock.opendj.ldap.AbstractEntry
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.forgerock.opendj.ldap.Entry
addAttribute, addAttribute, containsAnyAttributes, containsAnyAttributes, containsAttribute, containsAttribute, containsAttribute, getAllAttributes, getAllAttributes, getAttribute, parseAttribute, parseAttribute, removeAttribute, removeAttribute, replaceAttribute, setName
-
Constructor Details
-
LinkedHashMapEntry
public LinkedHashMapEntry()Creates an entry with an empty (root) distinguished name and no attributes. -
LinkedHashMapEntry
Creates an empty entry using the provided distinguished name and no attributes.- Parameters:
name- The distinguished name of this entry.- Throws:
NullPointerException- Ifnamewasnull.
-
LinkedHashMapEntry
Creates an empty entry using the provided distinguished name decoded using the default schema.- Parameters:
name- The distinguished name of this entry.- Throws:
LocalizedIllegalArgumentException- Ifnamecould not be decoded using the default schema.NullPointerException- Ifnamewasnull.
-
LinkedHashMapEntry
Creates a new entry using the provided lines of LDIF decoded using the default schema.- Parameters:
ldifLines- Lines of LDIF containing the an LDIF add change record or an LDIF entry record.- Throws:
LocalizedIllegalArgumentException- IfldifLineswas empty, or contained invalid LDIF, or could not be decoded using the default schema.NullPointerException- IfldifLineswasnull.
-
-
Method Details
-
deepCopyOfEntry
Creates an entry having the same distinguished name, attributes, and object classes of the provided entry. This constructor performs a deep copy ofentryand will copy each attribute as aLinkedAttribute.A shallow copy constructor is provided by
shallowCopyOfEntry(Entry).- Parameters:
entry- The entry to be copied.- Returns:
- A deep copy of
entry. - Throws:
NullPointerException- Ifentrywasnull.- See Also:
-
shallowCopyOfEntry
Creates an entry having the same distinguished name, attributes, and object classes of the provided entry. This constructor performs a shallow copy ofentryand will not copy the attributes contained inentry.A deep copy constructor is provided by
deepCopyOfEntry(Entry)- Parameters:
entry- The entry to be copied.- Returns:
- A shallow copy of
entry. - Throws:
NullPointerException- Ifentrywasnull.- See Also:
-