Package org.ldaptive
Class LdapEntry
- java.lang.Object
-
- org.ldaptive.AbstractMessage
-
- org.ldaptive.LdapEntry
-
- All Implemented Interfaces:
Message
public class LdapEntry extends AbstractMessage
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 }
- Author:
- Middleware Services
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
LdapEntry.AttributeParser
Parses a buffer containing an attribute name and it's values.protected static class
LdapEntry.AttributesHandler
Parse handler implementation for the attributes.static class
LdapEntry.Builder
protected static class
LdapEntry.LdapDnHandler
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
Fields Modifier and Type Field Description static int
PROTOCOL_OP
BER protocol number.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributes(java.util.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
equals(java.lang.Object o)
LdapAttribute
getAttribute()
Returns a single attribute of this attributes.LdapAttribute
getAttribute(java.lang.String name)
Returns the attribute with the supplied name.java.lang.String[]
getAttributeNames()
Returns the attribute names in this entry.java.util.Collection<LdapAttribute>
getAttributes()
Returns the ldap attributes.java.lang.String
getDn()
Returns the ldap DN.int
hashCode()
Returns the hash code for this object.void
removeAttribute(java.lang.String name)
Removes the attribute with the supplied name.void
removeAttributes(java.util.Collection<LdapAttribute> attrs)
Removes the attribute(s) from this ldap attributes.void
removeAttributes(LdapAttribute... attrs)
Removes an attribute from this ldap attributes.void
setDn(java.lang.String dn)
Sets the ldap DN.int
size()
Returns the number of attributes.static LdapEntry
sort(LdapEntry le)
Returns a new entry whose attributes are sorted naturally by name without options.java.lang.String
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 Detail
-
PROTOCOL_OP
public static final int PROTOCOL_OP
BER protocol number.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LdapEntry
public LdapEntry()
Default constructor.
-
LdapEntry
public LdapEntry(DERBuffer buffer)
Creates a new search result entry.- Parameters:
buffer
- to decode
-
-
Method Detail
-
getDn
public java.lang.String getDn()
Returns the ldap DN.- Returns:
- ldap DN
-
setDn
public void setDn(java.lang.String dn)
Sets the ldap DN.- Parameters:
dn
- ldap DN
-
getAttributes
public java.util.Collection<LdapAttribute> getAttributes()
Returns the ldap attributes.- Returns:
- ldap attributes
-
getAttribute
public LdapAttribute 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
public LdapAttribute getAttribute(java.lang.String name)
Returns the attribute with the supplied name.- Parameters:
name
- of the attribute to return- Returns:
- ldap attribute
-
getAttributeNames
public java.lang.String[] getAttributeNames()
Returns the attribute names in this entry.- Returns:
- string array of attribute names
-
addAttributes
public void addAttributes(LdapAttribute... attrs)
Adds attributes to the entry.- Parameters:
attrs
- attributes to add
-
addAttributes
public void addAttributes(java.util.Collection<LdapAttribute> attrs)
Adds attributes to the entry.- Parameters:
attrs
- attributes to add
-
removeAttribute
public void removeAttribute(java.lang.String name)
Removes the attribute with the supplied name.- Parameters:
name
- of attribute to remove
-
removeAttributes
public void removeAttributes(LdapAttribute... attrs)
Removes an attribute from this ldap attributes.- Parameters:
attrs
- attribute to remove
-
removeAttributes
public void removeAttributes(java.util.Collection<LdapAttribute> attrs)
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
public boolean equals(java.lang.Object o)
- 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
public java.lang.String toString()
- Overrides:
toString
in classAbstractMessage
-
sort
public static LdapEntry sort(LdapEntry le)
Returns a new entry whose attributes are sorted naturally by name without options.- Parameters:
le
- entry to sort- Returns:
- sorted entry
-
computeModifications
public 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.- 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
public static LdapEntry.Builder builder()
Creates a builder for this class.- Returns:
- new builder
-
-