org.cert.cc.jsr223
Class Jsr223ContextFactory

java.lang.Object
  extended by org.cert.cc.jsr223.Jsr223ContextFactory

public class Jsr223ContextFactory
extends Object

Creates and manages contexts for JSR-223 scripting

© 2011 Carnegie Mellon University

Author:
Aaron Reffett

Constructor Summary
protected Jsr223ContextFactory()
          Protected constructor
 
Method Summary
 ScriptEngine createScriptEngine(String language)
          Create a new script engine for the given language
static boolean eval(ScriptEngine engine, String script, boolean expected)
          Evaluate the given script with the given engine for the given value
static Jsr223ContextFactory getInstance()
          Returns the singleton JSR-223 Context Factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jsr223ContextFactory

protected Jsr223ContextFactory()
Protected constructor

Method Detail

getInstance

public static Jsr223ContextFactory getInstance()
Returns the singleton JSR-223 Context Factory

Returns:

createScriptEngine

public ScriptEngine createScriptEngine(String language)
Create a new script engine for the given language

Parameters:
language -
Returns:

eval

public static boolean eval(ScriptEngine engine,
                           String script,
                           boolean expected)
Evaluate the given script with the given engine for the given value

Parameters:
engine -
script -
expected -
Returns:
True if the script evaluates to a boolean and matches the expected value, false otherwise


Copyright © 2012 Carnegie Mellon University