Class LDAPAttribute
- java.lang.Object
-
- com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPAttribute
-
- All Implemented Interfaces:
java.io.Serializable
@NotExtensible @Mutable @ThreadSafety(level=NOT_THREADSAFE) public class LDAPAttribute extends java.lang.Object implements java.io.Serializable
This class provides a data structure that holds information about an LDAP attribute, including an attribute description (a base name or OID and optional set of options) and zero or more values.
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, theAttributeclass should be used instead.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LDAPAttribute(Attribute attr)Creates a new LDAP attribute from the providedAttributeobject.LDAPAttribute(LDAPAttribute attr)Creates a new LDAP attribute that is a duplicate of the provided attribute.LDAPAttribute(java.lang.String attrName)Creates a new LDAP attribute with the specified name and no values.LDAPAttribute(java.lang.String attrName, byte[] attrBytes)Creates a new LDAP attribute with the specified name and value.LDAPAttribute(java.lang.String attrName, java.lang.String attrString)Creates a new LDAP attribute with the specified name and value.LDAPAttribute(java.lang.String attrName, java.lang.String[] attrStrings)Creates a new LDAP attribute with the specified name and values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddValue(byte[] attrBytes)Adds the provided value to the set of values for this attribute.voidaddValue(java.lang.String attrString)Adds the provided value to the set of values for this attribute.java.lang.StringgetBaseName()Retrieves the base name for this attribute, without any options.static java.lang.StringgetBaseName(java.lang.String attrName)Retrieves the base name for the attribute with the provided name.byte[][]getByteValueArray()Retrieves an array of the values for this attribute.java.util.Enumeration<byte[]>getByteValues()Retrieves an enumeration over the binary values for this attribute.java.lang.StringgetLangSubtype()Retrieves the language subtype (i.e., the attribute option which begins with "lang-") for this attribute, if present.java.lang.StringgetName()Retrieves the name for this attribute.java.lang.String[]getStringValueArray()Retrieves an array of the values for this attribute.java.util.Enumeration<java.lang.String>getStringValues()Retrieves an enumeration over the string values for this attribute.java.lang.String[]getSubtypes()Retrieves the subtypes (i.e., attribute options) contained in the name for this attribute.static java.lang.String[]getSubtypes(java.lang.String attrName)Retrieves the subtypes (i.e., attribute options) contained in the provided attribute name.booleanhasSubtype(java.lang.String subtype)Indicates whether this attribute contains the specified subtype.booleanhasSubtypes(java.lang.String[] subtypes)Indicates whether this attribute contains all of the specified subtypes.voidremoveValue(byte[] attrValue)Removes the provided value from this attribute.voidremoveValue(java.lang.String attrValue)Removes the provided value from this attribute.intsize()Retrieves the number of values for this attribute.AttributetoAttribute()Converts this LDAP attribute to anAttributeobject.java.lang.StringtoString()Retrieves a string representation of this LDAP attribute.
-
-
-
Constructor Detail
-
LDAPAttribute
public LDAPAttribute(Attribute attr)
Creates a new LDAP attribute from the providedAttributeobject.- Parameters:
attr- The LDAP attribute to use to create this attribute.
-
LDAPAttribute
public LDAPAttribute(LDAPAttribute attr)
Creates a new LDAP attribute that is a duplicate of the provided attribute.- Parameters:
attr- The LDAP attribute to use to create this attribute.
-
LDAPAttribute
public LDAPAttribute(java.lang.String attrName)
Creates a new LDAP attribute with the specified name and no values.- Parameters:
attrName- The name for this attribute.
-
LDAPAttribute
public LDAPAttribute(java.lang.String attrName, byte[] attrBytes)
Creates a new LDAP attribute with the specified name and value.- Parameters:
attrName- The name for this attribute.attrBytes- The value for this attribute.
-
LDAPAttribute
public LDAPAttribute(java.lang.String attrName, java.lang.String attrString)
Creates a new LDAP attribute with the specified name and value.- Parameters:
attrName- The name for this attribute.attrString- The value for this attribute.
-
LDAPAttribute
public LDAPAttribute(java.lang.String attrName, java.lang.String[] attrStrings)
Creates a new LDAP attribute with the specified name and values.- Parameters:
attrName- The name for this attribute.attrStrings- The values for this attribute.
-
-
Method Detail
-
getName
public java.lang.String getName()
Retrieves the name for this attribute.- Returns:
- The name for this attribute.
-
getBaseName
public java.lang.String getBaseName()
Retrieves the base name for this attribute, without any options.- Returns:
- The base name for this attribute.
-
getBaseName
public static java.lang.String getBaseName(java.lang.String attrName)
Retrieves the base name for the attribute with the provided name.- Parameters:
attrName- The attribute name for which to retrieve the base name.- Returns:
- The base name for the attribute with the provided name.
-
getSubtypes
public java.lang.String[] getSubtypes()
Retrieves the subtypes (i.e., attribute options) contained in the name for this attribute.- Returns:
- The subtypes contained in the name for this attribute, or
nullif there are none.
-
getSubtypes
public static java.lang.String[] getSubtypes(java.lang.String attrName)
Retrieves the subtypes (i.e., attribute options) contained in the provided attribute name.- Parameters:
attrName- The attribute name from which to extract the subtypes.- Returns:
- The subtypes contained in the provided attribute name, or
nullif there are none.
-
getLangSubtype
public java.lang.String getLangSubtype()
Retrieves the language subtype (i.e., the attribute option which begins with "lang-") for this attribute, if present.- Returns:
- The language subtype for this attribute, or
nullif there is none.
-
hasSubtype
public boolean hasSubtype(java.lang.String subtype)
Indicates whether this attribute contains the specified subtype.- Parameters:
subtype- The subtype for which to make the determination.- Returns:
trueif this option has the specified subtype, orfalseif not.
-
hasSubtypes
public boolean hasSubtypes(java.lang.String[] subtypes)
Indicates whether this attribute contains all of the specified subtypes.- Parameters:
subtypes- The subtypes for which to make the determination.- Returns:
trueif this option has all of the specified subtypes, orfalseif not.
-
getStringValues
public java.util.Enumeration<java.lang.String> getStringValues()
Retrieves an enumeration over the string values for this attribute.- Returns:
- An enumeration over the string values for this attribute.
-
getStringValueArray
public java.lang.String[] getStringValueArray()
Retrieves an array of the values for this attribute.- Returns:
- An array of the values for this attribute.
-
getByteValues
public java.util.Enumeration<byte[]> getByteValues()
Retrieves an enumeration over the binary values for this attribute.- Returns:
- An enumeration over the binary values for this attribute.
-
getByteValueArray
public byte[][] getByteValueArray()
Retrieves an array of the values for this attribute.- Returns:
- An array of the values for this attribute.
-
addValue
public void addValue(java.lang.String attrString)
Adds the provided value to the set of values for this attribute.- Parameters:
attrString- The value to add to this attribute.
-
addValue
public void addValue(byte[] attrBytes)
Adds the provided value to the set of values for this attribute.- Parameters:
attrBytes- The value to add to this attribute.
-
removeValue
public void removeValue(java.lang.String attrValue)
Removes the provided value from this attribute.- Parameters:
attrValue- The value to remove.
-
removeValue
public void removeValue(byte[] attrValue)
Removes the provided value from this attribute.- Parameters:
attrValue- The value to remove.
-
size
public int size()
Retrieves the number of values for this attribute.- Returns:
- The number of values for this attribute.
-
toAttribute
public final Attribute toAttribute()
Converts this LDAP attribute to anAttributeobject.- Returns:
- The
Attributeobject which corresponds to this LDAP attribute.
-
toString
public java.lang.String toString()
Retrieves a string representation of this LDAP attribute.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this LDAP attribute.
-
-