org.apache.directory.api.ldap.model.entry
Interface Value<T>

All Superinterfaces:
Cloneable, Comparable<Value<T>>, Externalizable, Serializable
All Known Implementing Classes:
AbstractValue, BinaryValue, StringValue

public interface Value<T>
extends Cloneable, Externalizable, Comparable<Value<T>>

A interface for wrapping attribute values stored into an EntryAttribute. These values can be a String or a byte[].

Author:
Apache Directory Project

Field Summary
static boolean BINARY
           
static boolean STRING
          Two flags used to tell if the value is HR or not in serialization
 
Method Summary
 Value<T> clone()
          Clone a Value
 AttributeType getAttributeType()
          Get the associated AttributeType
 byte[] getBytes()
          Get the wrapped value as a byte[].
 T getNormReference()
          Gets a reference to the the normalized (canonical) representation for the wrapped value.
 T getNormValue()
          Gets the normalized (canonical) representation for the wrapped string.
 T getReference()
          Gets a reference to the wrapped value.
 String getString()
          Get the wrapped value as a String.
 T getValue()
          Get the wrapped value.
 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 checker)
          Uses the syntaxChecker associated with the attributeType to check if the value is valid.
 int length()
           
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

STRING

static final boolean STRING
Two flags used to tell if the value is HR or not in serialization

See Also:
Constant Field Values

BINARY

static final boolean BINARY
See Also:
Constant Field Values
Method Detail

clone

Value<T> clone()
Clone a Value

Returns:
A cloned value

isNull

boolean isNull()
Check if the contained value is null or not

Returns:
true if the inner value is null.

getAttributeType

AttributeType getAttributeType()
Get the associated AttributeType

Returns:
The AttributeType

isInstanceOf

boolean isInstanceOf(AttributeType attributeType)
Check if the value is stored into an instance of the given AttributeType, or one of its ascendant. For instance, if the Value is associated with a CommonName, checking for Name will match.

Parameters:
attributeType - The AttributeType we are looking at
Returns:
true if the value is associated with the given attributeType or one of its ascendant

getValue

T getValue()
Get the wrapped value. It will return a copy, not a reference.

Returns:
a copy of the wrapped value

getBytes

byte[] getBytes()
Get the wrapped value as a byte[]. If the original value is binary, this method will return a copy of the wrapped byte[]

Returns:
the wrapped value as a byte[]

getString

String getString()
Get the wrapped value as a String. If the original value is binary, this method will return the value as if it was an UTF-8 encoded String.

Returns:
the wrapped value as a String

getReference

T getReference()
Gets a reference to the wrapped value. Warning ! The value is not copied !!!

Returns:
a direct handle on the value that is wrapped

isSchemaAware

boolean isSchemaAware()
Tells if the value is schema aware or not.

Returns:
true if the value is sxhema aware

isValid

boolean isValid(SyntaxChecker checker)
                throws LdapInvalidAttributeValueException
Uses the syntaxChecker associated with the attributeType to check if the value is valid.

Parameters:
checker - the SyntaxChecker to use to validate the value
Returns:
true if the value is valid
Throws:
LdapInvalidAttributeValueException - if the value cannot be validated

getNormValue

T getNormValue()
Gets the normalized (canonical) representation for the wrapped string. If the wrapped String is null, null is returned, otherwise the normalized form is returned. If the normalizedValue is null, then this method will attempt to generate it from the wrapped value.

Returns:
gets the normalized value

getNormReference

T getNormReference()
Gets a reference to the the normalized (canonical) representation for the wrapped value.

Returns:
gets a reference to the normalized value

isHumanReadable

boolean isHumanReadable()
Tells if the current value is Human Readable

Returns:
true if the value is a String, false otherwise

length

int length()
Returns:
The length of the interned value


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.