Module xl

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

    Modifier and Type
    Method
    Description
    Returns the graph that shall be used in the context of the current thread.
    void
    Initializes this model.
    boolean
    isNode(Object value)
    Determines if value represents a valid node for this run-time model.
    boolean
    isWrapperFor(Object object, Type<?> type)
    Tests if the object is a wrapper for values of the given type.
    boolean
    Extracts the boolean value of a wrapper.
    byte
    unwrapByte(Object wrapper)
    Extracts the byte value of a wrapper.
    char
    unwrapChar(Object wrapper)
    Extracts the char value of a wrapper.
    double
    Extracts the double value of a wrapper.
    float
    Extracts the float value of a wrapper.
    int
    unwrapInt(Object wrapper)
    Extracts the int value of a wrapper.
    long
    unwrapLong(Object wrapper)
    Extracts the long value of a wrapper.
    Extracts the Object value of a wrapper.
    short
    Extracts the short value of a wrapper.
  • Method Details

    • initialize

      void initialize(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
    • 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
    • isWrapperFor

      boolean isWrapperFor(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
    • isNode

      boolean isNode(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
    • unwrapBoolean

      boolean unwrapBoolean(Object wrapper)
      Extracts the boolean value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapByte

      byte unwrapByte(Object wrapper)
      Extracts the byte value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapShort

      short unwrapShort(Object wrapper)
      Extracts the short value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapChar

      char unwrapChar(Object wrapper)
      Extracts the char value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapInt

      int unwrapInt(Object wrapper)
      Extracts the int value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapLong

      long unwrapLong(Object wrapper)
      Extracts the long value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapFloat

      float unwrapFloat(Object wrapper)
      Extracts the float value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapDouble

      double unwrapDouble(Object wrapper)
      Extracts the double value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper
    • unwrapObject

      Object unwrapObject(Object wrapper)
      Extracts the Object value of a wrapper.
      Parameters:
      wrapper - the wrapper
      Returns:
      the wrapped value of the wrapper