Class Bindery

java.lang.Object
net.sf.saxon.expr.instruct.Bindery

public final class Bindery extends Object
The Bindery class holds information about variables and their values. It is used only for global variables: local variables are held in the XPathContext object.

Variables are identified by a GlobalVariable object. Values will always be of class Sequence.

The Bindery is a run-time object, but slot numbers within the bindery are allocated to global variables at compile time. Because XSLT packages can be separately compiled, each package needs to have its own bindery.

From Saxon 9.7 there is one Bindery for the global variables in each separately-compiled package. The Bindery is no longer used to hold supplied values of global parameters, but it does hold their values after initialization, treating them as normal global variables. Management of dependencies among global variables, and checking for dynamic circularities, has been moved to the Controller.

  • Constructor Details

  • Method Details

    • setGlobalVariable

      public void setGlobalVariable(GlobalVariable binding, GroundedValue value)
      Provide a value for a global variable
      Parameters:
      binding - identifies the variable
      value - the value of the variable
    • saveGlobalVariableValue

      public GroundedValue saveGlobalVariableValue(GlobalVariable binding, GroundedValue value)
      Save the value of a global variable, and mark evaluation as complete.
      Parameters:
      binding - the global variable in question
      value - the value that this thread has obtained by evaluating the variable
      Returns:
      the value actually given to the variable. Exceptionally this will be different from the supplied value if another thread has evaluated the same global variable concurrently. The returned value should be used in preference, to ensure that all threads agree on the value. They could be different if for example the variable is initialized using the collection() function.
    • setGlobalVariableValue

      public void setGlobalVariableValue(int slot, GroundedValue value)
    • getGlobalVariableValue

      public GroundedValue getGlobalVariableValue(GlobalVariable binding)
      Get the value of a global variable
      Parameters:
      binding - the Binding that establishes the unique instance of the variable
      Returns:
      the Value of the variable if defined, null otherwise.
    • getGlobalVariable

      public GroundedValue getGlobalVariable(int slot)
      Get the value of a global variable whose slot number is known
      Parameters:
      slot - the slot number of the required variable
      Returns:
      the Value of the variable if defined, null otherwise.
    • getGlobalVariables

      public GroundedValue[] getGlobalVariables()
      Get all the global variables, as an array. This is provided for use by debuggers. The meaning of the result can be determined by use of data held in the corresponding PackageData.
      Returns:
      the array of global variables.