Package: org.codehaus.groovy.runtime

## [Java] Class ScriptReference

- org.codehaus.groovy.runtime.ScriptReference

-     public class ScriptReference
      extends Reference

  Represents a reference to a variable in a script

- - ### Constructor Summary

    Constructors
    Constructor and description
    `ScriptReference(Script script, String variable)` Constructs a ScriptReference to a variable in the given script.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Object` | `get()` Gets the current value of the referenced variable.
    `` | `public void` | `set(Object value)` Sets the value of the referenced variable.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Reference` | `get, getProperty, invokeMethod, set, setProperty`
    `class GroovyObjectSupport` | `getMetaClass, setMetaClass`

- - ### Constructor Detail

    - #### public ScriptReference(Script script, String variable)

      Constructs a ScriptReference to a variable in the given script.

      Parameters:
        `script` - the script instance
        `variable` - the name of the variable to reference

  - ### Method Detail

    - #### public Object get()

      Gets the current value of the referenced variable.

      Returns:
        the variable value from the script binding

    - #### public void set(Object value)

      Sets the value of the referenced variable.

      Parameters:
        `value` - the value to set in the script binding