public class Value extends Object implements Cloneable, Externalizable, Comparable<Value>
+---------+ | boolean | isHR flag +---------+ | boolean | TRUE if the value is not null, FALSE otherwise +---------+ [| int |] If the previous flag is TRUE, the length of the value [+---------+] [| byte[] |] The value itself [+---------+] | boolean | TRUE if we have a prepared String +---------+ [| String |] The prepared String if we have it [+---------+]
Constructor and Description |
---|
Value(AttributeType attributeType,
byte[] upValue)
Creates a schema aware binary Value with an initial value.
|
Value(AttributeType attributeType,
String upValue)
Creates a schema aware StringValue with an initial user provided String value.
|
Value(AttributeType attributeType,
String upValue,
String normValue)
Creates a schema aware StringValue with an initial user provided String value and
its normalized Value
|
Value(AttributeType attributeType,
Value value)
Creates a Value from an existing Value with an AttributeType
|
Value(byte[] value)
Creates a Value with an initial user provided binary value.
|
Value(String upValue)
Creates a Value with an initial user provided String value.
|
Modifier and Type | Method and Description |
---|---|
Value |
clone()
Clone a Value
|
int |
compareTo(byte[] other)
Compare two values.
|
int |
compareTo(String other)
Compare the current value with a String.
|
int |
compareTo(Value other)
Compare two values.
|
static Value |
createValue(AttributeType attributeType)
Create a Value with an AttributeType.
|
static Value |
deserialize(AttributeType attributeType,
ObjectInput in)
Deserialize a Value.
|
int |
deserialize(byte[] buffer,
int pos)
Deserialize a StringValue from a byte[], starting at a given position
|
static Value |
deserialize(ObjectInput in)
Deserialize a Value.
|
boolean |
equals(Object obj)
We compare two values using their Comparator, if any.
|
AttributeType |
getAttributeType()
Get the associated AttributeType
|
byte[] |
getBytes()
Get the wrapped value as a byte[], if and only if the Value is binary,
otherwise returns null.
|
String |
getEscaped() |
String |
getNormalized() |
String |
getString()
Get the User Provided value.
|
String |
getUpValue() |
int |
hashCode() |
boolean |
isHumanReadable()
Tells if the current value is Human Readable
|
boolean |
isInstanceOf(AttributeType attributeType)
Check if the value is stored into an instance of the given
AttributeType, or one of its ascendant.
|
boolean |
isNull()
Check if the contained value is null or not
|
boolean |
isSchemaAware()
Tells if the value is schema aware or not.
|
boolean |
isValid(SyntaxChecker syntaxChecker)
Uses the syntaxChecker associated with the attributeType to check if the
value is valid.
|
int |
length() |
void |
readExternal(ObjectInput in) |
int |
serialize(byte[] buffer,
int pos)
Serialize the Value into a buffer at the given position.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public Value(String upValue)
upValue
- the value to wrap. It can be nullpublic Value(byte[] value)
value
- the binary value to wrap which may be null, or a zero length byte arraypublic Value(AttributeType attributeType, byte[] upValue) throws LdapInvalidAttributeValueException
attributeType
- the schema type associated with this ValueupValue
- the value to wrapLdapInvalidAttributeValueException
- If the added value is invalid accordingly
to the schemapublic Value(AttributeType attributeType, String upValue) throws LdapInvalidAttributeValueException
attributeType
- the schema type associated with this StringValueupValue
- the value to wrapLdapInvalidAttributeValueException
- If the added value is invalid accordingly
to the schemapublic Value(AttributeType attributeType, String upValue, String normValue) throws LdapInvalidAttributeValueException
attributeType
- the schema type associated with this StringValueupValue
- the value to wrapnormValue
- the normalized value to wrapLdapInvalidAttributeValueException
- If the added value is invalid accordingly
to the schemapublic Value(AttributeType attributeType, Value value) throws LdapInvalidAttributeValueException
attributeType
- the schema attribute type associated with this StringValuevalue
- the original ValueLdapInvalidAttributeValueException
- If the value is invalidpublic static Value createValue(AttributeType attributeType)
attributeType
- The ATttributeType to usepublic boolean isNull()
true
if the inner value is null.public AttributeType getAttributeType()
public boolean isInstanceOf(AttributeType attributeType)
attributeType
- The AttributeType we are looking attrue
if the value is associated with the given
attributeType or one of its ascendantpublic String getEscaped()
public String getString()
public String getNormalized()
public String getUpValue()
public byte[] getBytes()
public boolean isSchemaAware()
true
if the value is sxhema awarepublic final boolean isValid(SyntaxChecker syntaxChecker) throws LdapInvalidAttributeValueException
syntaxChecker
- the SyntaxChecker to use to validate the valuetrue
if the value is validLdapInvalidAttributeValueException
- if the value cannot be validatedpublic boolean isHumanReadable()
true
if the value is a String, false
otherwisepublic int length()
public int serialize(byte[] buffer, int pos)
buffer
- The buffer which will contain the serialized StringValuepos
- The position in the buffer for the serialized valuepublic static Value deserialize(ObjectInput in) throws IOException, ClassNotFoundException
in
- The input streamIOException
- If the stream can't be readClassNotFoundException
- If we can't instanciate a Valuepublic static Value deserialize(AttributeType attributeType, ObjectInput in) throws IOException, ClassNotFoundException
attributeType
- The AttributeType associated with the Value. Can be nullin
- The input streamIOException
- If the stream can't be readClassNotFoundException
- If we can't instanciate a Valuepublic int deserialize(byte[] buffer, int pos) throws IOException, LdapInvalidAttributeValueException
buffer
- The buffer containing the StringValuepos
- The position in the bufferIOException
- If the serialized value is not a StringValueLdapInvalidAttributeValueException
- If the value is invalidpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public int compareTo(String other)
other
- the String we want to compare the current value withIllegalStateException
- on failures to extract the comparator, or the
normalizers needed to perform the required comparisons based on the schemapublic int compareTo(byte[] other)
other
- the byte[] we want to compare the current value withIllegalStateException
- on failures to extract the comparator, or the
normalizers needed to perform the required comparisons based on the schemapublic int compareTo(Value other)
compareTo
in interface Comparable<Value>
other
- The other Value we want to compare the current value withIllegalStateException
- on failures to extract the comparator, or the
normalizers needed to perform the required comparisons based on the schemapublic boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public String toString()
toString
in class Object
Object.toString()
Copyright © 2003–2021 The Apache Software Foundation. All rights reserved.