de.grogra.xl.query
Interface RuntimeModel

All Known Implementing Classes:
Runtime, RuntimeModel, RuntimeModel, RuntimeModel

public interface RuntimeModel

A RuntimeModel is used by the XL run-time system as an interface to the concrete relational data source in use. It corresponds to a compile-time model which was used at compile-time: The invocation of CompiletimeModel.getRuntimeName() returns a name, which is passed to RuntimeModelFactory.modelForName(java.lang.String, java.lang.ClassLoader) in order to obtain the corresponding RuntimeModel.

This interface contains methods related to unwrapping of values, for determining if a value represents a node value, and for the retrieval of a Graph associated with this model and the current thread. Roughly speaking, a RuntimeModel provides a set of operations, a Graph provides the data.

A comprehensive specification of the behaviour of RuntimeModel is given by the specification of the XL programming language.

Author:
Ole Kniemeyer

Method Summary
 Graph currentGraph()
          Returns the graph that shall be used in the context of the current thread.
 void initialize(java.lang.String params)
          Initializes this model.
 boolean isNode(java.lang.Object value)
          Determines if value represents a valid node for this run-time model.
 boolean isWrapperFor(java.lang.Object object, Type<?> type)
          Tests if the object is a wrapper for values of the given type.
 boolean unwrapBoolean(java.lang.Object wrapper)
          Extracts the boolean value of a wrapper.
 byte unwrapByte(java.lang.Object wrapper)
          Extracts the byte value of a wrapper.
 char unwrapChar(java.lang.Object wrapper)
          Extracts the char value of a wrapper.
 double unwrapDouble(java.lang.Object wrapper)
          Extracts the double value of a wrapper.
 float unwrapFloat(java.lang.Object wrapper)
          Extracts the float value of a wrapper.
 int unwrapInt(java.lang.Object wrapper)
          Extracts the int value of a wrapper.
 long unwrapLong(java.lang.Object wrapper)
          Extracts the long value of a wrapper.
 java.lang.Object unwrapObject(java.lang.Object wrapper)
          Extracts the Object value of a wrapper.
 short unwrapShort(java.lang.Object wrapper)
          Extracts the short value of a wrapper.
 

Method Detail

currentGraph

Graph currentGraph()
Returns the graph that shall be used in the context of the current thread. This is needed by graph-related XL statements which do not explicitly specify the graph to use.

Returns:
the current graph for this model

initialize

void initialize(java.lang.String params)
Initializes this model. This method is invoked by RuntimeModelFactory.modelForName(java.lang.String, java.lang.ClassLoader) after a new RuntimeModel instance has been created. The format of params depends on implementations of RuntimeModel.

Parameters:
params - initialization parameters, possibly null

isNode

boolean isNode(java.lang.Object value)
Determines if value represents a valid node for this run-time model.

Parameters:
value - the value to be tested
Returns:
true iff the value represents a node

isWrapperFor

boolean isWrapperFor(java.lang.Object object,
                     Type<?> type)
Tests if the object is a wrapper for values of the given type.

Parameters:
object - the potential wrapper to be tested
type - the value type
Returns:
true iff object is a wrapper for values of type type

unwrapBoolean

boolean unwrapBoolean(java.lang.Object wrapper)
Extracts the boolean value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapByte

byte unwrapByte(java.lang.Object wrapper)
Extracts the byte value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapChar

char unwrapChar(java.lang.Object wrapper)
Extracts the char value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapDouble

double unwrapDouble(java.lang.Object wrapper)
Extracts the double value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapFloat

float unwrapFloat(java.lang.Object wrapper)
Extracts the float value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapInt

int unwrapInt(java.lang.Object wrapper)
Extracts the int value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapLong

long unwrapLong(java.lang.Object wrapper)
Extracts the long value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapObject

java.lang.Object unwrapObject(java.lang.Object wrapper)
Extracts the Object value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper

unwrapShort

short unwrapShort(java.lang.Object wrapper)
Extracts the short value of a wrapper.

Parameters:
wrapper - the wrapper
Returns:
the wrapped value of the wrapper