org.exoplatform.services.jcr.rmi.api.value
Class BaseNonStreamValue

java.lang.Object
  extended by org.exoplatform.services.jcr.rmi.api.value.BaseNonStreamValue
All Implemented Interfaces:
java.io.Serializable, javax.jcr.Value, ExtendedValue, StatefulValue
Direct Known Subclasses:
BinaryValue, BooleanValue, DateValue, DoubleValue, LongValue, NameValue, PathValue, PermissionValue, ReferenceValue, StringValue

public abstract class BaseNonStreamValue
extends java.lang.Object
implements StatefulValue

The BaseNonStreamValue class implements the basic committed value state for non-stream values as a part of the State design pattern (Gof) used by this package.

This class implements all methods of the rmi.api.value.StatefullValue except getString and getType interface by always throwing an appropriate exception. Extensions of this class should overwrite methods as appropriate except for the getStream() which must throw an IllegalStateException for this line of committed non-stream states.

See Also:
Serialized Form

Field Summary
protected  int orderNumber
           
 
Constructor Summary
protected BaseNonStreamValue()
          Default constructor with no special tasks.
 
Method Summary
 boolean getBoolean()
          Always throws a ValueFormatException.
 java.util.Calendar getDate()
          Always throws a ValueFormatException.
 double getDouble()
          Always throws a ValueFormatException.
 long getLong()
          Always throws a ValueFormatException.
 int getOrderNumber()
           
 java.lang.String getReference()
           
 java.io.InputStream getStream()
          Always throws IllegalStateException because only non-stream getters are available from this implementation.
protected  javax.jcr.ValueFormatException getValueFormatException(java.lang.String destType)
          Returns a ValueFormatException with a message indicating what kind of type conversion is not supported.
 void setOrderNumber(int orderNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exoplatform.services.jcr.core.value.ExtendedValue
getLength
 
Methods inherited from interface javax.jcr.Value
getString, getType
 

Field Detail

orderNumber

protected int orderNumber
Constructor Detail

BaseNonStreamValue

protected BaseNonStreamValue()
Default constructor with no special tasks.

Method Detail

getOrderNumber

public int getOrderNumber()
Specified by:
getOrderNumber in interface ExtendedValue

setOrderNumber

public void setOrderNumber(int orderNumber)
Specified by:
setOrderNumber in interface ExtendedValue

getStream

public java.io.InputStream getStream()
                              throws java.lang.IllegalStateException
Always throws IllegalStateException because only non-stream getters are available from this implementation.

This method is declared final to mark that this line of implementations does not provide access to InputStreams.

Specified by:
getStream in interface javax.jcr.Value
Returns:
nothing
Throws:
java.lang.IllegalStateException - as defined above.

getBoolean

public boolean getBoolean()
                   throws javax.jcr.ValueFormatException
Always throws a ValueFormatException. Implementations should overwrite if conversion to boolean is supported.

Specified by:
getBoolean in interface javax.jcr.Value
Returns:
nothing
Throws:
javax.jcr.ValueFormatException - If the value cannot be converted to a boolean.

getDate

public java.util.Calendar getDate()
                           throws javax.jcr.ValueFormatException
Always throws a ValueFormatException. Implementations should overwrite if conversion to Calender is supported.

Specified by:
getDate in interface javax.jcr.Value
Returns:
nothing
Throws:
javax.jcr.ValueFormatException - If the value cannot be converted to a Calendar instance.

getDouble

public double getDouble()
                 throws javax.jcr.ValueFormatException
Always throws a ValueFormatException. Implementations should overwrite if conversion to double is supported.

Specified by:
getDouble in interface javax.jcr.Value
Returns:
nothing
Throws:
javax.jcr.ValueFormatException - If the value cannot be converted to a double.

getLong

public long getLong()
             throws javax.jcr.ValueFormatException
Always throws a ValueFormatException. Implementations should overwrite if conversion to long is supported.

Specified by:
getLong in interface javax.jcr.Value
Returns:
nothing
Throws:
javax.jcr.ValueFormatException - If the value cannot be converted to a long.

getValueFormatException

protected javax.jcr.ValueFormatException getValueFormatException(java.lang.String destType)
Returns a ValueFormatException with a message indicating what kind of type conversion is not supported.

Parameters:
destType - The name of the value type to which this value cannot be converted.
Returns:
nothing

getReference

public java.lang.String getReference()
                              throws javax.jcr.ValueFormatException,
                                     java.lang.IllegalStateException,
                                     javax.jcr.RepositoryException
Specified by:
getReference in interface ExtendedValue
Returns:
Throws:
javax.jcr.ValueFormatException - , IllegalStateException, RepositoryException
java.lang.IllegalStateException
javax.jcr.RepositoryException


Copyright © 2010 eXo Platform SAS. All Rights Reserved.