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 classLdapEntry.AttributeParserParses a buffer containing an attribute name and it's values.protected static classLdapEntry.AttributesHandlerParse handler implementation for the attributes.static classLdapEntry.Builderprotected static classLdapEntry.LdapDnHandlerParse 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 intPROTOCOL_OPBER protocol number.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttributes(java.util.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.booleanequals(java.lang.Object o)LdapAttributegetAttribute()Returns a single attribute of this attributes.LdapAttributegetAttribute(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.StringgetDn()Returns the ldap DN.inthashCode()Returns the hash code for this object.voidremoveAttribute(java.lang.String name)Removes the attribute with the supplied name.voidremoveAttributes(java.util.Collection<LdapAttribute> attrs)Removes the attribute(s) from this ldap attributes.voidremoveAttributes(LdapAttribute... attrs)Removes an attribute from this ldap attributes.voidsetDn(java.lang.String dn)Sets the ldap DN.intsize()Returns the number of attributes.static LdapEntrysort(LdapEntry le)Returns a new entry whose attributes are sorted naturally by name without options.java.lang.StringtoString()-
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:
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
public java.lang.String toString()
- Overrides:
toStringin 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
-
-