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 classParses a buffer containing an attribute name and it's values.protected static classParse handler implementation for the attributes.static classprotected static classParse 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 DERPathDER path to attributes.private static final inthash code seed.private static final DERPathDER path to LDAP DN.private StringLDAP DN of the entry.static final intBER protocol number. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttributes(Collection<LdapAttribute> attrs) Adds attributes to the entry.voidaddAttributes(LdapAttribute... attrs) Adds attributes to the entry.static LdapEntry.Builderbuilder()Creates a builder for this class.voidclear()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.booleanReturns 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.inthashCode()Returns the hash code for this object.voidremoveAttribute(String name) Removes the attribute with the supplied name.voidremoveAttributes(Collection<LdapAttribute> attrs) Removes the attribute(s) from this ldap attributes.voidremoveAttributes(LdapAttribute... attrs) Removes an attribute from this ldap attributes.voidSets the ldap DN.intsize()Returns the number of attributes.static LdapEntryReturns a new entry whose attributes are sorted naturally by name without options.toString()Methods inherited from class org.ldaptive.AbstractMessage
addControls, copyValues, getControls, getMessageID, setMessageIDMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
equalsin classAbstractMessage
-
hashCode
public int hashCode()Description copied from class:AbstractMessageReturns the hash code for this object.- Specified by:
hashCodein classAbstractMessage- Returns:
- hash code
-
toString
- Overrides:
toStringin 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
-