Package org.ldaptive

Class LdapAttribute.AttributeValue

java.lang.Object
org.ldaptive.LdapAttribute.AttributeValue
Enclosing class:
LdapAttribute

private static final class LdapAttribute.AttributeValue extends Object
Container for an attribute value. Supports helpers methods related to byte arrays and the notion of `binary` attribute values which are base64 encoded.
  • Field Details

    • HASH_CODE_SEED

      private static final int HASH_CODE_SEED
      hash code seed.
      See Also:
    • value

      private final byte[] value
      attribute value.
  • Constructor Details

    • AttributeValue

      AttributeValue(byte[] bytes, boolean copy)
      Creates a new attribute value.
      Parameters:
      bytes - byte array value
      copy - whether to copy the supplied bytes
  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getValue

      byte[] getValue(boolean copy)
      Returns the value of this attribute value.
      Parameters:
      copy - whether to create a copy of the underlying value
      Returns:
      value
    • getStringValue

      String getStringValue(boolean base64)
      Returns the value of this attribute value as a string.
      Parameters:
      base64 - whether value should be a base64 encoded string
      Returns:
      string value
    • equalsValue

      boolean equalsValue(byte[] bytes)
      Returns whether the supplied byte array equals this attribute value.
      Parameters:
      bytes - to compare
      Returns:
      whether the supplied byte array equals this attribute value
    • equalsValue

      boolean equalsValue(String string, boolean base64)
      Returns whether the supplied string equals this attribute value.
      Parameters:
      string - to compare
      base64 - whether the string is base64 encoded
      Returns:
      whether the supplied string equals this attribute value
    • fromString

      static LdapAttribute.AttributeValue fromString(String string, boolean base64)
      Creates a new attribute value from the supplied string.
      Parameters:
      string - to create attribute value from
      base64 - whether string should be base64 decoded
      Returns:
      new attribute value
    • copy

      Creates a copy of the supplied attribute value.
      Parameters:
      value - to create copy of
      Returns:
      new attribute value
    • base64Decode

      private static byte[] base64Decode(String string, boolean throwOnError)
      Base64 decodes the supplied string.
      Parameters:
      string - to decode
      throwOnError - whether throw if string cannot be decoded
      Returns:
      base64 decoded bytes or null if throwOnError if false and string cannot be decoded