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 Summary
Fields Modifier and Type Field Description private static int
HASH_CODE_SEED
hash code seed.private byte[]
value
attribute value.
-
Constructor Summary
Constructors Constructor Description AttributeValue(byte[] bytes, boolean copy)
Creates a new attribute value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static byte[]
base64Decode(String string, boolean throwOnError)
Base64 decodes the supplied string.(package private) static LdapAttribute.AttributeValue
copy(LdapAttribute.AttributeValue value)
Creates a copy of the supplied attribute value.boolean
equals(Object o)
(package private) boolean
equalsValue(byte[] bytes)
Returns whether the supplied byte array equals this attribute value.(package private) boolean
equalsValue(String string, boolean base64)
Returns whether the supplied string equals this attribute value.(package private) static LdapAttribute.AttributeValue
fromString(String string, boolean base64)
Creates a new attribute value from the supplied string.(package private) String
getStringValue(boolean base64)
Returns the value of this attribute value as a string.(package private) byte[]
getValue(boolean copy)
Returns the value of this attribute value.int
hashCode()
-
-
-
Field Detail
-
HASH_CODE_SEED
private static final int HASH_CODE_SEED
hash code seed.- See Also:
- Constant Field Values
-
value
private final byte[] value
attribute value.
-
-
Method Detail
-
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 comparebase64
- 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 frombase64
- whether string should be base64 decoded- Returns:
- new attribute value
-
copy
static LdapAttribute.AttributeValue copy(LdapAttribute.AttributeValue value)
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 decodethrowOnError
- whether throw if string cannot be decoded- Returns:
- base64 decoded bytes or null if throwOnError if false and string cannot be decoded
-
-