Class Attribute

java.lang.Object
com.unboundid.ldap.sdk.Attribute
All Implemented Interfaces:
Serializable

This class provides a data structure for holding information about an LDAP attribute, which includes an attribute name (which may include a set of attribute options) and zero or more values. Attribute objects are immutable and cannot be altered. However, if an attribute is included in an Entry object, then it is possible to add and remove attribute values from the entry (which will actually create new Attribute object instances), although this is not allowed for instances of ReadOnlyEntry and its subclasses.

This class uses the term "attribute name" as an equivalent of what the LDAP specification refers to as an "attribute description". An attribute description consists of an attribute type name or object identifier (which this class refers to as the "base name") followed by zero or more attribute options, each of which should be prefixed by a semicolon. Attribute options may be used to provide additional metadata for the attribute and/or its values, or to indicate special handling for the values. For example, RFC 3866 describes the use of attribute options to indicate that a value may be associated with a particular language (e.g., "cn;lang-en-US" indicates that the values of that cn attribute should be treated as U.S. English values), and RFC 4522 describes a binary encoding option that indicates that the server should only attempt to interact with the values as binary data (e.g., "userCertificate;binary") and should not treat them as strings. An attribute name (which is technically referred to as an "attribute description" in the protocol specification) may have zero, one, or multiple attribute options. If there are any attribute options, then a semicolon is used to separate the first option from the base attribute name, and to separate each subsequent attribute option from the previous option.

Attribute values can be treated as either strings or byte arrays. In LDAP, they are always transferred using a binary encoding, but applications frequently treat them as strings and it is often more convenient to do so. However, for some kinds of data (e.g., certificates, images, audio clips, and other "blobs") it may be desirable to only treat them as binary data and only interact with the values as byte arrays. If you do intend to interact with string values as byte arrays, then it is important to ensure that you use a UTF-8 representation for those values unless you are confident that the directory server will not attempt to treat the value as a string.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new LDAP attribute with the specified name and no values.
    Attribute(String name, byte[] value)
    Creates a new LDAP attribute with the specified name and value.
    Attribute(String name, byte[]... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, ASN1OctetString... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, MatchingRule matchingRule)
    Creates a new LDAP attribute with the specified name and no values.
    Attribute(String name, MatchingRule matchingRule, byte[] value)
    Creates a new LDAP attribute with the specified name and value.
    Attribute(String name, MatchingRule matchingRule, byte[]... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, MatchingRule matchingRule, ASN1OctetString[] values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, MatchingRule matchingRule, String value)
    Creates a new LDAP attribute with the specified name and value.
    Attribute(String name, MatchingRule matchingRule, String... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, MatchingRule matchingRule, Collection<String> values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, Schema schema, byte[]... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, Schema schema, ASN1OctetString[] values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, Schema schema, String... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, Schema schema, Collection<String> values)
    Creates a new LDAP attribute with the specified name and set of values.
    Attribute(String name, String value)
    Creates a new LDAP attribute with the specified name and value.
    Attribute(String name, String... values)
    Creates a new LDAP attribute with the specified name and set of values.
    Creates a new LDAP attribute with the specified name and set of values.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Attribute
    decode(ASN1Sequence encodedAttribute)
    Decodes the provided ASN.1 sequence as an LDAP attribute.
    Encodes this attribute into a form suitable for use in the LDAP protocol.
    boolean
    Indicates whether the provided object is equal to this LDAP attribute.
    Retrieves the base name for this attribute, which is the name or OID of the attribute type, without any attribute options.
    static String
    Retrieves the base name for an attribute with the given name, which will be the provided name without any attribute options.
    Retrieves the matching rule instance used by this attribute.
    Retrieves the name for this attribute (i.e., the attribute description), which may include zero or more attribute options.
    Retrieves the set of options for this attribute.
    static Set<String>
    Retrieves the set of options for the provided attribute name.
    Retrieves the set of values for this attribute as an array of ASN.1 octet strings.
    Retrieves the value for this attribute as a string.
    Retrieves the value for this attribute as a Boolean.
    Retrieves the value for this attribute as a Date, formatted using the generalized time syntax.
    Retrieves the value for this attribute as a DN.
    Retrieves the value for this attribute as an Integer.
    Retrieves the value for this attribute as a Long.
    byte[]
    Retrieves the value for this attribute as a byte array.
    byte[][]
    Retrieves the set of values for this attribute as byte arrays.
    Retrieves the set of values for this attribute as strings.
    int
    Generates a hash code for this LDAP attribute.
    boolean
    hasOption(String option)
    Indicates whether this attribute has the specified attribute option.
    static boolean
    hasOption(String name, String option)
    Indicates whether the provided attribute name has the specified attribute option.
    boolean
    Indicates whether this attribute has any attribute options.
    static boolean
    Indicates whether the provided attribute name contains any options.
    boolean
    Indicates whether this attribute contains at least one value.
    boolean
    hasValue(byte[] value)
    Indicates whether this attribute contains the specified value.
    boolean
    hasValue(byte[] value, MatchingRule matchingRule)
    Indicates whether this attribute contains the specified value.
    boolean
    Indicates whether this attribute contains the specified value.
    boolean
    hasValue(String value, MatchingRule matchingRule)
    Indicates whether this attribute contains the specified value.
    static Attribute
    Creates a new attribute containing the merged values of the provided attributes.
    static Attribute
    mergeAttributes(Attribute attr1, Attribute attr2, MatchingRule matchingRule)
    Creates a new attribute containing the merged values of the provided attributes.
    boolean
    Indicates whether the name of this attribute is valid as per RFC 4512.
    static boolean
    Indicates whether the provided string represents a valid attribute name as per RFC 4512.
    static boolean
    nameIsValid(String s, boolean allowOptions)
    Indicates whether the provided string represents a valid attribute name as per RFC 4512.
    boolean
    Indicates whether any of the values of this attribute need to be base64-encoded when represented as LDIF.
    static boolean
    Indicates whether the provided value needs to be base64-encoded when represented as LDIF.
    static boolean
    Indicates whether the provided value needs to be base64-encoded when represented as LDIF.
    static Attribute
    Reads and decodes an attribute from the provided ASN.1 stream reader.
    static Attribute
    readFrom(ASN1StreamReader reader, Schema schema)
    Reads and decodes an attribute from the provided ASN.1 stream reader.
    static Attribute
    Creates a new attribute containing all of the values of the first attribute that are not contained in the second attribute.
    static Attribute
    removeValues(Attribute attr1, Attribute attr2, MatchingRule matchingRule)
    Creates a new attribute containing all of the values of the first attribute that are not contained in the second attribute.
    int
    Retrieves the number of values for this attribute.
    Retrieves a string representation of this LDAP attribute.
    void
    Appends a string representation of this LDAP attribute to the provided buffer.
    void
    Writes an ASN.1-encoded representation of this attribute to the provided ASN.1 buffer.

    Methods inherited from class java.lang.Object

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

    • Attribute

      public Attribute(@NotNull String name)
      Creates a new LDAP attribute with the specified name and no values.
      Parameters:
      name - The name for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull String value)
      Creates a new LDAP attribute with the specified name and value.
      Parameters:
      name - The name for this attribute. It must not be null.
      value - The value for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull byte[] value)
      Creates a new LDAP attribute with the specified name and value.
      Parameters:
      name - The name for this attribute. It must not be null.
      value - The value for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull String... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull byte[]... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull ASN1OctetString... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      values - The set of raw values for this attribute. It must not be null.
    • Attribute

      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule)
      Creates a new LDAP attribute with the specified name and no values.
      Parameters:
      name - The name for this attribute. It must not be null.
      matchingRule - The matching rule to use when comparing values. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule, @NotNull String value)
      Creates a new LDAP attribute with the specified name and value.
      Parameters:
      name - The name for this attribute. It must not be null.
      matchingRule - The matching rule to use when comparing values. It must not be null.
      value - The value for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule, @NotNull byte[] value)
      Creates a new LDAP attribute with the specified name and value.
      Parameters:
      name - The name for this attribute. It must not be null.
      matchingRule - The matching rule to use when comparing values. It must not be null.
      value - The value for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule, @NotNull String... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      matchingRule - The matching rule to use when comparing values. It must not be null.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule, @NotNull byte[]... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      matchingRule - The matching rule to use when comparing values. It must not be null.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule, @NotNull Collection<String> values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      matchingRule - The matching rule to use when comparing values. It must not be null.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @NotNull MatchingRule matchingRule, @NotNull ASN1OctetString[] values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute.
      matchingRule - The matching rule for this attribute.
      values - The set of values for this attribute.
    • Attribute

      public Attribute(@NotNull String name, @Nullable Schema schema, @NotNull String... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      schema - The schema to use to select the matching rule for this attribute. It may be null if the default matching rule should be used.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @Nullable Schema schema, @NotNull byte[]... values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      schema - The schema to use to select the matching rule for this attribute. It may be null if the default matching rule should be used.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      schema - The schema to use to select the matching rule for this attribute. It may be null if the default matching rule should be used.
      values - The set of values for this attribute. It must not be null.
    • Attribute

      public Attribute(@NotNull String name, @Nullable Schema schema, @NotNull ASN1OctetString[] values)
      Creates a new LDAP attribute with the specified name and set of values.
      Parameters:
      name - The name for this attribute. It must not be null.
      schema - The schema to use to select the matching rule for this attribute. It may be null if the default matching rule should be used.
      values - The set of values for this attribute. It must not be null.
  • Method Details

    • mergeAttributes

      Creates a new attribute containing the merged values of the provided attributes. Any duplicate values will only be present once in the resulting attribute. The names of the provided attributes must be the same.
      Parameters:
      attr1 - The first attribute containing the values to merge. It must not be null.
      attr2 - The second attribute containing the values to merge. It must not be null.
      Returns:
      The new attribute containing the values of both of the provided attributes.
    • mergeAttributes

      Creates a new attribute containing the merged values of the provided attributes. Any duplicate values will only be present once in the resulting attribute. The names of the provided attributes must be the same.
      Parameters:
      attr1 - The first attribute containing the values to merge. It must not be null.
      attr2 - The second attribute containing the values to merge. It must not be null.
      matchingRule - The matching rule to use to locate matching values. It may be null if the matching rule associated with the first attribute should be used.
      Returns:
      The new attribute containing the values of both of the provided attributes.
    • removeValues

      Creates a new attribute containing all of the values of the first attribute that are not contained in the second attribute. Any values contained in the second attribute that are not contained in the first will be ignored. The names of the provided attributes must be the same.
      Parameters:
      attr1 - The attribute from which to remove the values. It must not be null.
      attr2 - The attribute containing the values to remove. It must not be null.
      Returns:
      A new attribute containing all of the values of the first attribute not contained in the second. It may contain zero values if all the values of the first attribute were also contained in the second.
    • removeValues

      Creates a new attribute containing all of the values of the first attribute that are not contained in the second attribute. Any values contained in the second attribute that are not contained in the first will be ignored. The names of the provided attributes must be the same.
      Parameters:
      attr1 - The attribute from which to remove the values. It must not be null.
      attr2 - The attribute containing the values to remove. It must not be null.
      matchingRule - The matching rule to use to locate matching values. It may be null if the matching rule associated with the first attribute should be used.
      Returns:
      A new attribute containing all of the values of the first attribute not contained in the second. It may contain zero values if all the values of the first attribute were also contained in the second.
    • getName

      Retrieves the name for this attribute (i.e., the attribute description), which may include zero or more attribute options.
      Returns:
      The name for this attribute.
    • getBaseName

      Retrieves the base name for this attribute, which is the name or OID of the attribute type, without any attribute options. For an attribute without any options, the value returned by this method will be identical the value returned by the getName() method.
      Returns:
      The base name for this attribute.
    • getBaseName

      @NotNull public static String getBaseName(@NotNull String name)
      Retrieves the base name for an attribute with the given name, which will be the provided name without any attribute options. If the given name does not include any attribute options, then it will be returned unaltered. If it does contain one or more attribute options, then the name will be returned without those options.
      Parameters:
      name - The name to be processed.
      Returns:
      The base name determined from the provided attribute name.
    • nameIsValid

      public boolean nameIsValid()
      Indicates whether the name of this attribute is valid as per RFC 4512. The name will be considered valid only if it starts with an ASCII alphabetic character ('a' through 'z', or 'A' through 'Z'), and contains only ASCII alphabetic characters, ASCII numeric digits ('0' through '9'), and the ASCII hyphen character ('-'). It will also be allowed to include zero or more attribute options, in which the option must be separate from the base name by a semicolon and has the same naming constraints as the base name.
      Returns:
      true if this attribute has a valid name, or false if not.
    • nameIsValid

      public static boolean nameIsValid(@NotNull String s)
      Indicates whether the provided string represents a valid attribute name as per RFC 4512. It will be considered valid only if it starts with an ASCII alphabetic character ('a' through 'z', or 'A' through 'Z'), and contains only ASCII alphabetic characters, ASCII numeric digits ('0' through '9'), and the ASCII hyphen character ('-'). It will also be allowed to include zero or more attribute options, in which the option must be separate from the base name by a semicolon and has the same naming constraints as the base name.
      Parameters:
      s - The name for which to make the determination.
      Returns:
      true if this attribute has a valid name, or false if not.
    • nameIsValid

      public static boolean nameIsValid(@NotNull String s, boolean allowOptions)
      Indicates whether the provided string represents a valid attribute name as per RFC 4512. It will be considered valid only if it starts with an ASCII alphabetic character ('a' through 'z', or 'A' through 'Z'), and contains only ASCII alphabetic characters, ASCII numeric digits ('0' through '9'), and the ASCII hyphen character ('-'). It may optionally be allowed to include zero or more attribute options, in which the option must be separate from the base name by a semicolon and has the same naming constraints as the base name.
      Parameters:
      s - The name for which to make the determination.
      allowOptions - Indicates whether the provided name will be allowed to contain attribute options.
      Returns:
      true if this attribute has a valid name, or false if not.
    • hasOptions

      public boolean hasOptions()
      Indicates whether this attribute has any attribute options.
      Returns:
      true if this attribute has at least one attribute option, or false if not.
    • hasOptions

      public static boolean hasOptions(@NotNull String name)
      Indicates whether the provided attribute name contains any options.
      Parameters:
      name - The name for which to make the determination.
      Returns:
      true if the provided attribute name has at least one attribute option, or false if not.
    • hasOption

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

      public static boolean hasOption(@NotNull String name, @NotNull String option)
      Indicates whether the provided attribute name has the specified attribute option.
      Parameters:
      name - The name to be examined.
      option - The attribute option for which to make the determination.
      Returns:
      true if the provided attribute name has the specified attribute option, or false if not.
    • getOptions

      Retrieves the set of options for this attribute.
      Returns:
      The set of options for this attribute, or an empty set if there are none.
    • getOptions

      @NotNull public static Set<String> getOptions(@NotNull String name)
      Retrieves the set of options for the provided attribute name.
      Parameters:
      name - The name to be examined.
      Returns:
      The set of options for the provided attribute name, or an empty set if there are none.
    • getMatchingRule

      Retrieves the matching rule instance used by this attribute.
      Returns:
      The matching rule instance used by this attribute.
    • getValue

      Retrieves the value for this attribute as a string. If this attribute has multiple values, then the first value will be returned.
      Returns:
      The value for this attribute, or null if this attribute does not have any values.
    • getValueByteArray

      @Nullable public byte[] getValueByteArray()
      Retrieves the value for this attribute as a byte array. If this attribute has multiple values, then the first value will be returned. The returned array must not be altered by the caller.
      Returns:
      The value for this attribute, or null if this attribute does not have any values.
    • getValueAsBoolean

      Retrieves the value for this attribute as a Boolean. If this attribute has multiple values, then the first value will be examined. Values of "true", "t", "yes", "y", "on", and "1" will be interpreted as TRUE. Values of "false", "f", "no", "n", "off", and "0" will be interpreted as FALSE.
      Returns:
      The Boolean value for this attribute, or null if this attribute does not have any values or the value cannot be parsed as a Boolean.
    • getValueAsDate

      Retrieves the value for this attribute as a Date, formatted using the generalized time syntax. If this attribute has multiple values, then the first value will be examined.
      Returns:
      The Date value for this attribute, or null if this attribute does not have any values or the value cannot be parsed as a Date.
    • getValueAsDN

      Retrieves the value for this attribute as a DN. If this attribute has multiple values, then the first value will be examined.
      Returns:
      The DN value for this attribute, or null if this attribute does not have any values or the value cannot be parsed as a DN.
    • getValueAsInteger

      Retrieves the value for this attribute as an Integer. If this attribute has multiple values, then the first value will be examined.
      Returns:
      The Integer value for this attribute, or null if this attribute does not have any values or the value cannot be parsed as an Integer.
    • getValueAsLong

      Retrieves the value for this attribute as a Long. If this attribute has multiple values, then the first value will be examined.
      Returns:
      The Long value for this attribute, or null if this attribute does not have any values or the value cannot be parsed as a Long.
    • getValues

      Retrieves the set of values for this attribute as strings. The returned array must not be altered by the caller.
      Returns:
      The set of values for this attribute, or an empty array if it does not have any values.
    • getValueByteArrays

      @NotNull public byte[][] getValueByteArrays()
      Retrieves the set of values for this attribute as byte arrays. The returned array must not be altered by the caller.
      Returns:
      The set of values for this attribute, or an empty array if it does not have any values.
    • getRawValues

      Retrieves the set of values for this attribute as an array of ASN.1 octet strings. The returned array must not be altered by the caller.
      Returns:
      The set of values for this attribute as an array of ASN.1 octet strings.
    • hasValue

      public boolean hasValue()
      Indicates whether this attribute contains at least one value.
      Returns:
      true if this attribute has at least one value, or false if not.
    • hasValue

      public boolean hasValue(@NotNull String value)
      Indicates whether this attribute contains the specified value.
      Parameters:
      value - The value for which to make the determination. It must not be null.
      Returns:
      true if this attribute has the specified value, or false if not.
    • hasValue

      public boolean hasValue(@NotNull String value, @NotNull MatchingRule matchingRule)
      Indicates whether this attribute contains the specified value.
      Parameters:
      value - The value for which to make the determination. It must not be null.
      matchingRule - The matching rule to use when making the determination. It must not be null.
      Returns:
      true if this attribute has the specified value, or false if not.
    • hasValue

      public boolean hasValue(@NotNull byte[] value)
      Indicates whether this attribute contains the specified value.
      Parameters:
      value - The value for which to make the determination. It must not be null.
      Returns:
      true if this attribute has the specified value, or false if not.
    • hasValue

      public boolean hasValue(@NotNull byte[] value, @NotNull MatchingRule matchingRule)
      Indicates whether this attribute contains the specified value.
      Parameters:
      value - The value for which to make the determination. It must not be null.
      matchingRule - The matching rule to use when making the determination. It must not be null.
      Returns:
      true if this attribute has the specified value, or false if not.
    • size

      public int size()
      Retrieves the number of values for this attribute.
      Returns:
      The number of values for this attribute.
    • writeTo

      public void writeTo(@NotNull ASN1Buffer buffer)
      Writes an ASN.1-encoded representation of this attribute to the provided ASN.1 buffer.
      Parameters:
      buffer - The ASN.1 buffer to which the encoded representation should be written.
    • encode

      Encodes this attribute into a form suitable for use in the LDAP protocol. It will be encoded as a sequence containing the attribute name (as an octet string) and a set of values.
      Returns:
      An ASN.1 sequence containing the encoded attribute.
    • readFrom

      Reads and decodes an attribute from the provided ASN.1 stream reader.
      Parameters:
      reader - The ASN.1 stream reader from which to read the attribute.
      Returns:
      The decoded attribute.
      Throws:
      LDAPException - If a problem occurs while trying to read or decode the attribute.
    • readFrom

      Reads and decodes an attribute from the provided ASN.1 stream reader.
      Parameters:
      reader - The ASN.1 stream reader from which to read the attribute.
      schema - The schema to use to select the appropriate matching rule for this attribute. It may be null if the default matching rule should be selected.
      Returns:
      The decoded attribute.
      Throws:
      LDAPException - If a problem occurs while trying to read or decode the attribute.
    • decode

      @NotNull public static Attribute decode(@NotNull ASN1Sequence encodedAttribute) throws LDAPException
      Decodes the provided ASN.1 sequence as an LDAP attribute.
      Parameters:
      encodedAttribute - The ASN.1 sequence to be decoded as an LDAP attribute. It must not be null.
      Returns:
      The decoded LDAP attribute.
      Throws:
      LDAPException - If a problem occurs while attempting to decode the provided ASN.1 sequence as an LDAP attribute.
    • needsBase64Encoding

      public boolean needsBase64Encoding()
      Indicates whether any of the values of this attribute need to be base64-encoded when represented as LDIF.
      Returns:
      true if any of the values of this attribute need to be base64-encoded when represented as LDIF, or false if not.
    • needsBase64Encoding

      public static boolean needsBase64Encoding(@NotNull String v)
      Indicates whether the provided value needs to be base64-encoded when represented as LDIF.
      Parameters:
      v - The value for which to make the determination. It must not be null.
      Returns:
      true if the provided value needs to be base64-encoded when represented as LDIF, or false if not.
    • needsBase64Encoding

      public static boolean needsBase64Encoding(@NotNull byte[] v)
      Indicates whether the provided value needs to be base64-encoded when represented as LDIF.
      Parameters:
      v - The value for which to make the determination. It must not be null.
      Returns:
      true if the provided value needs to be base64-encoded when represented as LDIF, or false if not.
    • hashCode

      public int hashCode()
      Generates a hash code for this LDAP attribute. It will be the sum of the hash codes for the lowercase attribute name and the normalized values.
      Overrides:
      hashCode in class Object
      Returns:
      The generated hash code for this LDAP attribute.
    • equals

      public boolean equals(@Nullable Object o)
      Indicates whether the provided object is equal to this LDAP attribute. The object will be considered equal to this LDAP attribute only if it is an LDAP attribute with the same name and set of values.
      Overrides:
      equals in class Object
      Parameters:
      o - The object for which to make the determination.
      Returns:
      true if the provided object may be considered equal to this LDAP attribute, or false if not.
    • toString

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

      public void toString(@NotNull StringBuilder buffer)
      Appends a string representation of this LDAP attribute to the provided buffer.
      Parameters:
      buffer - The buffer to which the string representation of this LDAP attribute should be appended.