org.apache.directory.shared.ldap.entry
Interface Value<T>

All Superinterfaces:
java.lang.Cloneable, java.lang.Comparable<Value<T>>, java.io.Externalizable, java.io.Serializable
All Known Implementing Classes:
AbstractValue, ClientBinaryValue, ClientStringValue

public interface Value<T>
extends java.lang.Cloneable, java.io.Externalizable, java.lang.Comparable<Value<T>>

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

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Method Summary
 void clear()
          Reset the value
 Value<T> clone()
           
 T get()
          Get the wrapped value.
 T getCopy()
          Get a copy of the stored value.
 T getNormalizedValue()
          Gets the normalized (canonical) representation for the wrapped string.
 T getNormalizedValueCopy()
          Gets a copy of the the normalized (canonical) representation for the wrapped value.
 T getNormalizedValueReference()
          Gets a reference to the the normalized (canonical) representation for the wrapped value.
 T getReference()
          Get a reference on the stored value.
 boolean isBinary()
          Tells if the current value is Binary or String
 boolean isNormalized()
          Tells if the value has already be normalized or not.
 boolean isNull()
          Check if the contained value is null or not
 boolean isValid()
          Tells if the value is valid.
 boolean isValid(SyntaxChecker checker)
          Tells if the value is valid wrt a Syntax checker
 void normalize()
          Normalize the value.
 void normalize(Normalizer normalizer)
          Normalize the value.
 void set(T wrapped)
          Sets the wrapped value.
 void setNormalized(boolean normalized)
          Set the normalized flag.
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

clone

Value<T> clone()

isNull

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

Returns:
true if the inner value is null.

set

void set(T wrapped)
Sets the wrapped value.

Parameters:
wrapped - the value to set: either a String, URI, or a byte[]

get

T get()
Get the wrapped value.

Returns:
the wrapped value

getReference

T getReference()
Get a reference on the stored value.

Returns:
a reference on the wrapped value.

getCopy

T getCopy()
Get a copy of the stored value.

Returns:
a copy of the stored value.

clear

void clear()
Reset the value


isNormalized

boolean isNormalized()
Tells if the value has already be normalized or not.

Returns:
true if the value has already been normalized.

isValid

boolean isValid()
Tells if the value is valid. The value must have already been validated at least once through a call to isValid( SyntaxChecker ).

Returns:
true if the value is valid

isValid

boolean isValid(SyntaxChecker checker)
                throws javax.naming.NamingException
Tells if the value is valid wrt a Syntax checker

Parameters:
checker - the SyntaxChecker to use to validate the value
Returns:
true if the value is valid
Throws:
javax.naming.NamingException - if the value cannot be validated

setNormalized

void setNormalized(boolean normalized)
Set the normalized flag.

Parameters:
normalized - the value : true or false

getNormalizedValue

T getNormalizedValue()
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: repeated calls to this method do not unnecessarily normalize the wrapped value. Only changes to the wrapped value result in attempts to normalize the wrapped value.

Returns:
gets the normalized value

getNormalizedValueReference

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

Returns:
gets a reference to the normalized value

getNormalizedValueCopy

T getNormalizedValueCopy()
Gets a copy of the the normalized (canonical) representation for the wrapped value.

Returns:
gets a copy of the normalized value

normalize

void normalize()
               throws javax.naming.NamingException
Normalize the value. In order to use this method, the Value must be schema aware.

Throws:
javax.naming.NamingException - if the value cannot be normalized

normalize

void normalize(Normalizer normalizer)
               throws javax.naming.NamingException
Normalize the value. For a client String value, applies the given normalizer. It supposes that the client has access to the schema in order to select the appropriate normalizer.

Parameters:
normalizer - the normalizer to apply to the value
Throws:
javax.naming.NamingException - if the value cannot be normalized

isBinary

boolean isBinary()
Tells if the current value is Binary or String

Returns:
true if the value is Binary, false otherwise


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.