Package org.ldaptive
Class LdapEntry
java.lang.Object
org.ldaptive.AbstractMessage
org.ldaptive.LdapEntry
- All Implemented Interfaces:
Message
LDAP search result entry defined as:
SearchResultEntry ::= [APPLICATION 4] SEQUENCE { objectName LDAPDN, attributes PartialAttributeList } PartialAttributeList ::= SEQUENCE OF partialAttribute PartialAttribute PartialAttribute ::= SEQUENCE { type AttributeDescription, vals SET OF value AttributeValue }
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Parses a buffer containing an attribute name and it's values.protected static class
Parse handler implementation for the attributes.static class
protected static class
Parse handler implementation for the LDAP DN.Nested classes/interfaces inherited from class org.ldaptive.AbstractMessage
AbstractMessage.AbstractBuilder<B,
T extends AbstractMessage>, AbstractMessage.ControlParser, AbstractMessage.ControlsHandler, AbstractMessage.MessageIDHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map
<String, LdapAttribute> LDAP attributes on the entry.private static final DERPath
DER path to attributes.private static final int
hash code seed.private static final DERPath
DER path to LDAP DN.private String
LDAP DN of the entry.static final int
BER protocol number. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributes
(Collection<LdapAttribute> attrs) Adds attributes to the entry.void
addAttributes
(LdapAttribute... attrs) Adds attributes to the entry.static LdapEntry.Builder
builder()
Creates a builder for this class.void
clear()
Removes all the attributes.static AttributeModification[]
computeModifications
(LdapEntry source, LdapEntry target) Returns the list of attribute modifications needed to change the supplied target entry into the supplied source entry.boolean
Returns a single attribute of this attributes.getAttribute
(String name) Returns the attribute with the supplied name.String[]
Returns the attribute names in this entry.Returns the ldap attributes.getDn()
Returns the ldap DN.int
hashCode()
Returns the hash code for this object.void
removeAttribute
(String name) Removes the attribute with the supplied name.void
removeAttributes
(Collection<LdapAttribute> attrs) Removes the attribute(s) from this ldap attributes.void
removeAttributes
(LdapAttribute... attrs) Removes an attribute from this ldap attributes.void
Sets the ldap DN.int
size()
Returns the number of attributes.static LdapEntry
Returns a new entry whose attributes are sorted naturally by name without options.toString()
Methods inherited from class org.ldaptive.AbstractMessage
addControls, copyValues, getControls, getMessageID, setMessageID
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ldaptive.Message
getControl
-
Field Details
-
PROTOCOL_OP
public static final int PROTOCOL_OPBER protocol number.- See Also:
-
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
LDAP_DN_PATH
DER path to LDAP DN. -
ATTRIBUTES_PATH
DER path to attributes. -
ldapDn
LDAP DN of the entry. -
attributes
LDAP attributes on the entry.
-
-
Constructor Details
-
LdapEntry
public LdapEntry()Default constructor. -
LdapEntry
Creates a new search result entry.- Parameters:
buffer
- to decode
-
-
Method Details
-
getDn
Returns the ldap DN.- Returns:
- ldap DN
-
setDn
Sets the ldap DN.- Parameters:
dn
- ldap DN
-
getAttributes
Returns the ldap attributes.- Returns:
- ldap attributes
-
getAttribute
Returns a single attribute of this attributes. If multiple attributes exist the first attribute returned by the underlying iterator is used. If no attributes exist null is returned.- Returns:
- single attribute
-
getAttribute
Returns the attribute with the supplied name.- Parameters:
name
- of the attribute to return- Returns:
- ldap attribute
-
getAttributeNames
Returns the attribute names in this entry.- Returns:
- string array of attribute names
-
addAttributes
Adds attributes to the entry.- Parameters:
attrs
- attributes to add
-
addAttributes
Adds attributes to the entry.- Parameters:
attrs
- attributes to add
-
removeAttribute
Removes the attribute with the supplied name.- Parameters:
name
- of attribute to remove
-
removeAttributes
Removes an attribute from this ldap attributes.- Parameters:
attrs
- attribute to remove
-
removeAttributes
Removes the attribute(s) from this ldap attributes.- Parameters:
attrs
- collection of ldap attributes to remove
-
size
public int size()Returns the number of attributes.- Returns:
- number of attributes
-
clear
public void clear()Removes all the attributes. -
equals
- Overrides:
equals
in classAbstractMessage
-
hashCode
public int hashCode()Description copied from class:AbstractMessage
Returns the hash code for this object.- Specified by:
hashCode
in classAbstractMessage
- Returns:
- hash code
-
toString
- Overrides:
toString
in classAbstractMessage
-
sort
Returns a new entry whose attributes are sorted naturally by name without options.- Parameters:
le
- entry to sort- Returns:
- sorted entry
-
computeModifications
Returns the list of attribute modifications needed to change the supplied target entry into the supplied source entry.- Parameters:
source
- ldap entry containing new datatarget
- ldap entry containing existing data- Returns:
- attribute modifications needed to change target into source or an empty array
-
builder
Creates a builder for this class.- Returns:
- new builder
-