org.apache.jackrabbit.value
Class BaseValue

java.lang.Object
  extended byorg.apache.jackrabbit.value.BaseValue
All Implemented Interfaces:
Value
Direct Known Subclasses:
BinaryValue, BooleanValue, DateValue, DoubleValue, LongValue, NameValue, PathValue, ReferenceValue, StringValue

public abstract class BaseValue
extends Object
implements Value

This class is the superclass of the type-specific classes implementing the Value interfaces.

See Also:
Value, StringValue, LongValue, DoubleValue, BooleanValue, DateValue, BinaryValue, NameValue, PathValue, ReferenceValue

Field Summary
protected static String DEFAULT_ENCODING
           
protected  InputStream stream
           
protected  int type
           
 
Method Summary
 boolean getBoolean()
          
 Calendar getDate()
          
 double getDouble()
          
protected abstract  String getInternalString()
          Returns the internal string representation of this value without modifying the value state.
 long getLong()
          
 InputStream getStream()
          
 String getString()
          
 int getType()
          
protected  void setStreamConsumed()
          Checks if the non-stream value of this instance has already been consumed (if any getter methods except getStream() and getType() have been previously called at least once) and sets the state to STATE_STREAM_CONSUMED.
protected  void setValueConsumed()
          Checks if the stream value of this instance has already been consumed (if getStream() has been previously called at least once) and sets the state to STATE_VALUE_CONSUMED.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

protected static final String DEFAULT_ENCODING
See Also:
Constant Field Values

type

protected final int type

stream

protected InputStream stream
Method Detail

setStreamConsumed

protected void setStreamConsumed()
                          throws IllegalStateException
Checks if the non-stream value of this instance has already been consumed (if any getter methods except getStream() and getType() have been previously called at least once) and sets the state to STATE_STREAM_CONSUMED.

Throws:
IllegalStateException - if any getter methods other than getStream() and getType() have been previously called at least once.

setValueConsumed

protected void setValueConsumed()
                         throws IllegalStateException
Checks if the stream value of this instance has already been consumed (if getStream() has been previously called at least once) and sets the state to STATE_VALUE_CONSUMED.

Throws:
IllegalStateException - if getStream() has been previously called at least once.

getInternalString

protected abstract String getInternalString()
                                     throws ValueFormatException,
                                            RepositoryException
Returns the internal string representation of this value without modifying the value state.

Returns:
the internal string representation
Throws:
ValueFormatException - if the value can not be represented as a String or if the value is null.
RepositoryException - if another error occurs.

getType

public int getType()

Specified by:
getType in interface Value

getDate

public Calendar getDate()
                 throws ValueFormatException,
                        IllegalStateException,
                        RepositoryException

Specified by:
getDate in interface Value
Throws:
ValueFormatException
IllegalStateException
RepositoryException

getLong

public long getLong()
             throws ValueFormatException,
                    IllegalStateException,
                    RepositoryException

Specified by:
getLong in interface Value
Throws:
ValueFormatException
IllegalStateException
RepositoryException

getBoolean

public boolean getBoolean()
                   throws ValueFormatException,
                          IllegalStateException,
                          RepositoryException

Specified by:
getBoolean in interface Value
Throws:
ValueFormatException
IllegalStateException
RepositoryException

getDouble

public double getDouble()
                 throws ValueFormatException,
                        IllegalStateException,
                        RepositoryException

Specified by:
getDouble in interface Value
Throws:
ValueFormatException
IllegalStateException
RepositoryException

getStream

public InputStream getStream()
                      throws IllegalStateException,
                             RepositoryException

Specified by:
getStream in interface Value
Throws:
IllegalStateException
RepositoryException

getString

public String getString()
                 throws ValueFormatException,
                        IllegalStateException,
                        RepositoryException

Specified by:
getString in interface Value
Throws:
ValueFormatException
IllegalStateException
RepositoryException


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.