## groovy.lang
Class DoSetContext

Field Summary
`ClassLoader` | `classLoader`

Constructor Summary
`DoSetContext(ClassLoader loader)`

Method Summary
`Object` | `evaluate(GroovyCodeSource codeSource)` Evaluates some script against the current Binding and returns the result
`Object` | `evaluate(String scriptText, String fileName)` Evaluates some script against the current Binding and returns the result
`Object` | `evaluate(String scriptText, String fileName, String codeBase)` Evaluates some script against the current Binding and returns the result.
`Object` | `evaluate(File file)` Evaluates some script against the current Binding and returns the result
`Object` | `evaluate(String scriptText)` Evaluates some script against the current Binding and returns the result
`Object` | `evaluate(InputStream in)` Evaluates some script against the current Binding and returns the result
`Object` | `evaluate(InputStream in, String fileName)` Evaluates some script against the current Binding and returns the result
`String` | `generateScriptName()`
`Object` | `getVariable(String name)`
`boolean` | `isJUnit3Test(Class scriptClass)` Utility method to check through reflection if the class appears to be a JUnit 3.8.x test, i.e.
`boolean` | `isJUnit4Test(Class scriptClass)` Utility method to check via reflection if the parsed class appears to be a JUnit4 test, i.e.
`boolean` | `isTestNgTest(Class scriptClass)` Utility method to check via reflection if the parsed class appears to be a TestNG test, i.e.
`Script` | `parse(InputStream in, String fileName)` Parses the given script and returns it ready to be run
`Script` | `parse(GroovyCodeSource codeSource)` Parses the given script and returns it ready to be run.
`Script` | `parse(File file)` Parses the given script and returns it ready to be run
`Script` | `parse(String scriptText)` Parses the given script and returns it ready to be run
`Script` | `parse(String scriptText, String fileName)`
`Script` | `parse(InputStream in)` Parses the given script and returns it ready to be run
`Class` | `parseClass(GroovyCodeSource codeSource)` Parses the groovy code contained in codeSource and returns a java class.
`Object` | `run()`
`Object` | `run(String scriptText, String fileName, def args)` Runs the given script text with command line arguments
`Object` | `run(InputStream in, String fileName, def args)` Runs the given script with command line arguments
`Object` | `runJUnit3Test(Class scriptClass)` Run the specified class extending TestCase as a unit test.
`Object` | `runJUnit4Test(Class scriptClass)`
`Object` | `runMainOrTestOrRunnable(Class scriptClass, def args)`
`Object` | `runRunnable(Class scriptClass, def args)`
`Object` | `runTestNgTest(Class scriptClass)`
`void` | `setVariable(String name, Object value)`

Constructor Detail

### DoSetContext

    public DoSetContext(ClassLoader loader)

Method Detail

### evaluate

    public Object evaluate(GroovyCodeSource codeSource)

  Evaluates some script against the current Binding and returns the result
  param:
    codeSource
  throws:
    CompilationFailedException
  throws:
    CompilationFailedException

### evaluate

    public Object evaluate(String scriptText, String fileName)

  Evaluates some script against the current Binding and returns the result
  param:
    scriptText the text of the script
  param:
    fileName is the logical file name of the script (which is used to create the class name of the script)

### evaluate

    public Object evaluate(String scriptText, String fileName, String codeBase)

  Evaluates some script against the current Binding and returns the result. The .class file created from the script is given the supplied codeBase

### evaluate

    public Object evaluate(File file)

  Evaluates some script against the current Binding and returns the result
  param:
    file is the file of the script (which is used to create the class name of the script)

### evaluate

    public Object evaluate(String scriptText)

  Evaluates some script against the current Binding and returns the result
  param:
    scriptText the text of the script

### evaluate

    public Object evaluate(InputStream in)

  Evaluates some script against the current Binding and returns the result
  param:
    in the stream reading the script

### evaluate

    public Object evaluate(InputStream in, String fileName)

  Evaluates some script against the current Binding and returns the result
  param:
    in the stream reading the script
  param:
    fileName is the logical file name of the script (which is used to create the class name of the script)

### generateScriptName

    String generateScriptName()

### getVariable

    public Object getVariable(String name)

### isJUnit3Test

    boolean isJUnit3Test(Class scriptClass)

  Utility method to check through reflection if the class appears to be a JUnit 3.8.x test, i.e.&nsbp;checks if it extends JUnit 3.8.x's TestCase.
  param:
    scriptClass the class we want to check
  return:
    true if the class appears to be a test

### isJUnit4Test

    boolean isJUnit4Test(Class scriptClass)

  Utility method to check via reflection if the parsed class appears to be a JUnit4 test, i.e.&nsbp;checks whether it appears to be using the relevant JUnit 4 annotations.
  param:
    scriptClass the class we want to check
  return:
    true if the class appears to be a test

### isTestNgTest

    boolean isTestNgTest(Class scriptClass)

  Utility method to check via reflection if the parsed class appears to be a TestNG test, i.e.&nsbp;checks whether it appears to be using the relevant TestNG annotations.
  param:
    scriptClass the class we want to check
  return:
    true if the class appears to be a test

### parse

    public Script parse(InputStream in, String fileName)

  Parses the given script and returns it ready to be run
  param:
    in the stream reading the script
  param:
    fileName is the logical file name of the script (which is used to create the class name of the script)
  return:
    the parsed script which is ready to be run via @link Script.run()

### parse

    public Script parse(GroovyCodeSource codeSource)

  Parses the given script and returns it ready to be run. When running in a secure environment (-Djava.security.manager) codeSource.getCodeSource() determines what policy grants should be given to the script.
  param:
    codeSource
  return:
    ready to run script

### parse

    public Script parse(File file)

  Parses the given script and returns it ready to be run
  param:
    file is the file of the script (which is used to create the class name of the script)

### parse

    public Script parse(String scriptText)

  Parses the given script and returns it ready to be run
  param:
    scriptText the text of the script

### parse

    public Script parse(String scriptText, String fileName)

### parse

    public Script parse(InputStream in)

  Parses the given script and returns it ready to be run
  param:
    in the stream reading the script

### parseClass

    Class parseClass(GroovyCodeSource codeSource)

  Parses the groovy code contained in codeSource and returns a java class.

### run

    public Object run()

### run

    public Object run(String scriptText, String fileName, def args)

  Runs the given script text with command line arguments
  param:
    scriptText is the text content of the script
  param:
    fileName is the logical file name of the script (which is used to create the class name of the script)
  param:
    args the command line arguments to pass in

### run

    public Object run(InputStream in, String fileName, def args)

  Runs the given script with command line arguments
  param:
    in the stream reading the script
  param:
    fileName is the logical file name of the script (which is used to create the class name of the script)
  param:
    args the command line arguments to pass in

### runJUnit3Test

    Object runJUnit3Test(Class scriptClass)

  Run the specified class extending TestCase as a unit test. This is done through reflection, to avoid adding a dependency to the JUnit framework. Otherwise, developers embedding Groovy and using GroovyShell to load/parse/compile groovy scripts and classes would have to add another dependency on their classpath.
  param:
    scriptClass the class to be run as a unit test

### runJUnit4Test

    Object runJUnit4Test(Class scriptClass)

### runMainOrTestOrRunnable

    Object runMainOrTestOrRunnable(Class scriptClass, def args)

### runRunnable

    Object runRunnable(Class scriptClass, def args)

### runTestNgTest

    Object runTestNgTest(Class scriptClass)

### setVariable

    public void setVariable(String name, Object value)