Package com.isode.dsapi.util
Class MapEntry
java.lang.Object
com.isode.dsapi.util.MapEntry
MapEntry is a JNI-free representation of an entry designed for fast
random access to attributes, designed for extensively modifying an
entry in place.
- Author:
- jp
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a new attribute, for compatibility with ISeqEntry.boolean
add
(AttributeType at, AttributeValue av) Add a value to an attribute, creating the Attribute if necessary, and eliminating duplicate values (if they are exactly the same).void
delete
(AttributeType at) Delete an attribute by type; no error if it is not there.void
Delete all attributes.Get a particular attribute by attribute-type.Get the Collection of Attributes contained in the map.getDN()
Get the DNGet the MapEntry.Get the original DNboolean
Check whether the DN has changed.boolean
isEmpty()
Is the entry empty (no attributes)?iterator()
Iteratorboolean
remove
(AttributeType at, AttributeValue av) Remove a value from an attribute.void
Add a new attribute, or replace an existing attribute; if there are no values in the attribute, then any existing attribute is deleted and nothing is put in its place.void
Set the DNvoid
Set the original DN.Convert to an AddEntrytoEntry()
Convert to an EntryConvert to a SeqEntrytoString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
dn
DN -
orig_dn
Original DN (to detect changes) -
map
Map of attributes
-
-
Constructor Details
-
MapEntry
Constructor from SeqEntry -
MapEntry
Constructor from a DN -
MapEntry
Constructor from Entry -
MapEntry
Constructor from AddEntry
-
-
Method Details
-
iterator
Iterator -
isEmpty
public boolean isEmpty()Is the entry empty (no attributes)? -
getAttributes
Get the Collection of Attributes contained in the map.- Returns:
- Collection
-
getAttribute
Get a particular attribute by attribute-type.- Parameters:
at
- AttributeType- Returns:
- Attribute found, or null if not found
-
toSeqEntry
Convert to a SeqEntry- Returns:
- SeqEntry
-
toAddEntry
Convert to an AddEntry- Specified by:
toAddEntry
in interfaceISeqEntry
- Returns:
- AddEntry
-
toEntry
Convert to an Entry -
getMapEntry
Get the MapEntry.- Specified by:
getMapEntry
in interfaceISeqEntry
- Returns:
- MapEntry
-
getDN
Get the DN -
setDN
Set the DN -
getOrigDN
Get the original DN -
setOrigDN
Set the original DN. This is normally a bad idea, as the original DN must usually be maintained to refer back to the original source of the entry correctly. -
hasDNChanged
public boolean hasDNChanged()Check whether the DN has changed.- Specified by:
hasDNChanged
in interfaceISeqEntry
-
add
Add a new attribute, for compatibility with ISeqEntry. Does the same as replace(). -
replace
Add a new attribute, or replace an existing attribute; if there are no values in the attribute, then any existing attribute is deleted and nothing is put in its place.- Parameters:
attr
- Attribute to add or replace
-
delete
Delete an attribute by type; no error if it is not there. -
deleteAll
public void deleteAll()Delete all attributes. This makes this a blank entry, which will return 'null' when converted to a SeqEntry. -
add
Add a value to an attribute, creating the Attribute if necessary, and eliminating duplicate values (if they are exactly the same).- Parameters:
at
-av
-- Returns:
- 'true' if the value was added, 'false' if this was a duplicate
- Throws:
BadSyntaxException
- if the syntax of av is not valid for this attribute.
-
remove
Remove a value from an attribute. This means recreating the Attribute each time, so it may be faster to use replace() if many deletions have to be done.- Returns:
- 'true' if the value was found and removed, 'false' if it was not found.
- Throws:
BadSyntaxException
-
toString
-