dsql.value
Class Value

java.lang.Object
  extended bydsql.DMExecuted
      extended bydsql.value.Value
Direct Known Subclasses:
NonScalarValue, ScalarValue

public abstract class Value
extends DMExecuted

A value, ie the result of a DSQL expression.


Constructor Summary
Value()
           
 
Method Summary
abstract  boolean getBoolean()
           
 java.lang.Object getField(java.lang.String name)
          Access an object's field
 float getFloat()
           
 int getInt()
           
abstract  ConstructedResults getMeta()
           
 java.lang.Object getObject()
          Attempt to return a Java object, e.g.
 java.lang.Class getObjectClass()
          return the object class; some scalars return the primitive class (eg Integer.TYPE, rather than Integer.getClass()
 RecordHolder getRecordHolder()
          XmlDataValue uses this to provide an iterator for XML documents
abstract  java.lang.String getString()
           
 java.lang.Object getType(java.lang.Class cl)
           
static Value getValue(DSQL _caller, java.lang.Object obj)
          Cast an arbitrary object to a Value.
static Value getValue(DSQL _caller, java.lang.Object obj, java.lang.Class cl)
          This method is used by ASTMethodCall because of primitive return types; it will cast an IntValue for a primitive int, but will make a JavaObject for an Integer object
abstract  boolean isScalar()
           
abstract  void print(ASTPrint printer)
          Print this value using printer
 void setField(java.lang.String name, Value val)
           
 
Methods inherited from class dsql.DMExecuted
getCaller, setCaller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Value

public Value()
Method Detail

getString

public abstract java.lang.String getString()
                                    throws ExecuteException
Returns:
a string representation of this value, to be used within dsql expressions. This is distinct from toString(), which is used to output the object for debugging purposes.
Throws:
ExecuteException

getBoolean

public abstract boolean getBoolean()
                            throws ExecuteException
Returns:
true if this Value is "non-zero", e.g. non-empty string, tables has some record, etc.
Throws:
ExecuteException

getInt

public int getInt()
           throws ExecuteException
Returns:
this Value as an integer
Throws:
ExecuteException

getFloat

public float getFloat()
               throws ExecuteException
Returns:
this Value as a float number
Throws:
ExecuteException

getRecordHolder

public RecordHolder getRecordHolder()
                             throws ExecuteException
XmlDataValue uses this to provide an iterator for XML documents

Throws:
ExecuteException

getType

public java.lang.Object getType(java.lang.Class cl)
                         throws ExecuteException
Throws:
ExecuteException

getObject

public java.lang.Object getObject()
Attempt to return a Java object, e.g. StringValue returns String, JavaObject returns the embedded object, etc. This is used when passing values to java constructors and methods


getObjectClass

public java.lang.Class getObjectClass()
return the object class; some scalars return the primitive class (eg Integer.TYPE, rather than Integer.getClass()


getField

public java.lang.Object getField(java.lang.String name)
                          throws ExecuteException
Access an object's field

Throws:
ExecuteException

setField

public void setField(java.lang.String name,
                     Value val)
              throws ExecuteException
Throws:
ExecuteException

isScalar

public abstract boolean isScalar()
Returns:
true if this value is a scalar, e.g. number, string, etc.

getValue

public static Value getValue(DSQL _caller,
                             java.lang.Object obj)
Cast an arbitrary object to a Value.

Returns:
the same object if it is already a Value

getValue

public static Value getValue(DSQL _caller,
                             java.lang.Object obj,
                             java.lang.Class cl)
This method is used by ASTMethodCall because of primitive return types; it will cast an IntValue for a primitive int, but will make a JavaObject for an Integer object


getMeta

public abstract ConstructedResults getMeta()
                                    throws ExecuteException
Returns:
meta-information about this Value, e.g. for a table, it returns the names,types,width,etc. of its columns.
Throws:
ExecuteException

print

public abstract void print(ASTPrint printer)
                    throws ExecuteException
Print this value using printer

Throws:
ExecuteException