Class LDAPAttributeSet
- java.lang.Object
-
- com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPAttributeSet
-
- All Implemented Interfaces:
java.io.Serializable
@NotExtensible @Mutable @ThreadSafety(level=NOT_THREADSAFE) public class LDAPAttributeSet extends java.lang.Object implements java.io.Serializable
This class provides a data structure that contains a set of LDAP attribute objects.
This class is primarily intended to be used in the process of updating applications which use the Netscape Directory SDK for Java to switch to or coexist with the UnboundID LDAP SDK for Java. For applications not written using the Netscape Directory SDK for Java, arrays or collections ofAttributeobjects should be used instead.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LDAPAttributeSet()Creates a new LDAP attribute set with no attributes.LDAPAttributeSet(LDAPAttribute[] attrs)Creates a new LDAP attribute set with the provided attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(LDAPAttribute attr)Adds the provided attribute to this attribute set.LDAPAttributeSetduplicate()Creates a duplicate of this attribute set.LDAPAttributeelementAt(int index)Retrieves the attribute at the specified position in this attribute set.LDAPAttributegetAttribute(java.lang.String attrName)Retrieves the attribute from this set whose name exactly matches the provided name.LDAPAttributegetAttribute(java.lang.String attrName, java.lang.String lang)Retrieves the attribute with the specified base name and the specified language subtype.java.util.Enumeration<LDAPAttribute>getAttributes()Retrieves an enumeration of the attributes in this set.LDAPAttributeSetgetSubset(java.lang.String subtype)Retrieves a subset of the attributes in this attribute set which contain the specified subtype.voidremove(java.lang.String name)Removes the attribute with the specified name.voidremoveElementAt(int index)Removes the attribute at the specified position in this attribute set.intsize()Retrieves the number of attributes contained in this attribute set.java.lang.StringtoString()Retrieves a string representation of this attribute set.
-
-
-
Constructor Detail
-
LDAPAttributeSet
public LDAPAttributeSet()
Creates a new LDAP attribute set with no attributes.
-
LDAPAttributeSet
public LDAPAttributeSet(@NotNull LDAPAttribute[] attrs)
Creates a new LDAP attribute set with the provided attributes.- Parameters:
attrs- The set of attributes to include in the set.
-
-
Method Detail
-
getAttributes
@NotNull public java.util.Enumeration<LDAPAttribute> getAttributes()
Retrieves an enumeration of the attributes in this set.- Returns:
- An enumeration of the attributes in this set.
-
getSubset
@NotNull public LDAPAttributeSet getSubset(@NotNull java.lang.String subtype)
Retrieves a subset of the attributes in this attribute set which contain the specified subtype.- Parameters:
subtype- The subtype for which to retrieve all of the attributes.- Returns:
- A new attribute set with all attributes from this set containing the specified subtype.
-
getAttribute
@Nullable public LDAPAttribute getAttribute(@NotNull java.lang.String attrName)
Retrieves the attribute from this set whose name exactly matches the provided name.- Parameters:
attrName- The name of the attribute to retrieve.- Returns:
- The requested attribute, or
nullif there is no such attribute in this set.
-
getAttribute
@Nullable public LDAPAttribute getAttribute(@NotNull java.lang.String attrName, @Nullable java.lang.String lang)
Retrieves the attribute with the specified base name and the specified language subtype.- Parameters:
attrName- The base name for the attribute to retrieve.lang- The language subtype to retrieve, ornullif there should not be a language subtype.- Returns:
- The attribute with the specified base name and language subtype,
or
nullif there is no such attribute.
-
elementAt
@NotNull public LDAPAttribute elementAt(int index) throws java.lang.IndexOutOfBoundsException
Retrieves the attribute at the specified position in this attribute set.- Parameters:
index- The position of the attribute to retrieve.- Returns:
- The attribute at the specified position.
- Throws:
java.lang.IndexOutOfBoundsException- If the provided index invalid.
-
add
public void add(@NotNull LDAPAttribute attr)
Adds the provided attribute to this attribute set.- Parameters:
attr- The attribute to be added to this set.
-
remove
public void remove(@NotNull java.lang.String name)
Removes the attribute with the specified name.- Parameters:
name- The name of the attribute to remove.
-
removeElementAt
public void removeElementAt(int index) throws java.lang.IndexOutOfBoundsException
Removes the attribute at the specified position in this attribute set.- Parameters:
index- The position of the attribute to remove.- Throws:
java.lang.IndexOutOfBoundsException- If the provided index is invalid.
-
size
public int size()
Retrieves the number of attributes contained in this attribute set.- Returns:
- The number of attributes contained in this attribute set.
-
duplicate
@NotNull public LDAPAttributeSet duplicate()
Creates a duplicate of this attribute set.- Returns:
- A duplicate of this attribute set.
-
-