Class LDAPAttribute

java.lang.Object
com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPAttribute
All Implemented Interfaces:
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, the Attribute class should be used instead.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new LDAP attribute from the provided Attribute object.
    Creates a new LDAP attribute that is a duplicate of the provided attribute.
    Creates a new LDAP attribute with the specified name and no values.
    LDAPAttribute(String attrName, byte[] attrBytes)
    Creates a new LDAP attribute with the specified name and value.
    LDAPAttribute(String attrName, String attrString)
    Creates a new LDAP attribute with the specified name and value.
    LDAPAttribute(String attrName, String[] attrStrings)
    Creates a new LDAP attribute with the specified name and values.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addValue(byte[] attrBytes)
    Adds the provided value to the set of values for this attribute.
    void
    addValue(String attrString)
    Adds the provided value to the set of values for this attribute.
    Retrieves the base name for this attribute, without any options.
    static String
    getBaseName(String attrName)
    Retrieves the base name for the attribute with the provided name.
    byte[][]
    Retrieves an array of the values for this attribute.
    Enumeration<byte[]>
    Retrieves an enumeration over the binary values for this attribute.
    Retrieves the language subtype (i.e., the attribute option which begins with "lang-") for this attribute, if present.
    Retrieves the name for this attribute.
    Retrieves an array of the values for this attribute.
    Retrieves an enumeration over the string values for this attribute.
    Retrieves the subtypes (i.e., attribute options) contained in the name for this attribute.
    static String[]
    getSubtypes(String attrName)
    Retrieves the subtypes (i.e., attribute options) contained in the provided attribute name.
    boolean
    hasSubtype(String subtype)
    Indicates whether this attribute contains the specified subtype.
    boolean
    hasSubtypes(String[] subtypes)
    Indicates whether this attribute contains all of the specified subtypes.
    void
    removeValue(byte[] attrValue)
    Removes the provided value from this attribute.
    void
    removeValue(String attrValue)
    Removes the provided value from this attribute.
    int
    Retrieves the number of values for this attribute.
    final Attribute
    Converts this LDAP attribute to an Attribute object.
    Retrieves a string representation of this LDAP attribute.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LDAPAttribute

      Creates a new LDAP attribute from the provided Attribute object.
      Parameters:
      attr - The LDAP attribute to use to create this attribute.
    • LDAPAttribute

      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(@NotNull String attrName)
      Creates a new LDAP attribute with the specified name and no values.
      Parameters:
      attrName - The name for this attribute.
    • LDAPAttribute

      public LDAPAttribute(@NotNull String attrName, @NotNull 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(@NotNull String attrName, @NotNull 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(@NotNull String attrName, @NotNull 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 Details

    • getName

      Retrieves the name for this attribute.
      Returns:
      The name for this attribute.
    • getBaseName

      Retrieves the base name for this attribute, without any options.
      Returns:
      The base name for this attribute.
    • getBaseName

      @NotNull public static String getBaseName(@NotNull 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

      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 null if there are none.
    • getSubtypes

      @Nullable public static String[] getSubtypes(@NotNull 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 null if there are none.
    • 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 null if there is none.
    • hasSubtype

      public boolean hasSubtype(@NotNull String subtype)
      Indicates whether this attribute contains the specified subtype.
      Parameters:
      subtype - The subtype for which to make the determination.
      Returns:
      true if this option has the specified subtype, or false if not.
    • hasSubtypes

      public boolean hasSubtypes(@NotNull String[] subtypes)
      Indicates whether this attribute contains all of the specified subtypes.
      Parameters:
      subtypes - The subtypes for which to make the determination.
      Returns:
      true if this option has all of the specified subtypes, or false if not.
    • getStringValues

      Retrieves an enumeration over the string values for this attribute.
      Returns:
      An enumeration over the string values for this attribute.
    • getStringValueArray

      Retrieves an array of the values for this attribute.
      Returns:
      An array of the values for this attribute.
    • getByteValues

      Retrieves an enumeration over the binary values for this attribute.
      Returns:
      An enumeration over the binary values for this attribute.
    • getByteValueArray

      @NotNull 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(@NotNull 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(@NotNull 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(@NotNull String attrValue)
      Removes the provided value from this attribute.
      Parameters:
      attrValue - The value to remove.
    • removeValue

      public void removeValue(@NotNull 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

      @NotNull public final Attribute toAttribute()
      Converts this LDAP attribute to an Attribute object.
      Returns:
      The Attribute object which corresponds to this LDAP attribute.
    • toString

      Retrieves a string representation of this LDAP attribute.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this LDAP attribute.