class JavaScripPredicate extends AbstractAdviserPredicate {

  @Override
  public void init() throws Exception {
    javaScripExpression = checkNotNull(getParameterValue(PARAMETER_JAVASCRIPT_EXPRESSION));
    ScriptEngine engine = createJavaScriptEngine();
    /*
     * TODO(robertom): Wrap PredicateExecutionContext in a JavaScriptPredicateExecutionContext and
     * reintroduce PredicateExecutionContext.newBuilder().
     */
    engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE)
        .put(BINDING_NAME_CONTEXT, predicateExecutionContext);
    try {
      engine.eval(javaScripExpression);
    } catch (Exception e) {
      throw new Exception(
          String.format("Error [%s] while parsing javascript expression [%s].",
              e.getMessage(),
              javaScripExpression),
          e);
    }
    this.scriptEngine = (Invocable) engine;
    try {
      scriptEngine.invokeFunction(FUNCTION_INIT);
    } catch (NoSuchMethodException e) {
      // Intentionally empty.
    } catch (ScriptException e) {
      throw new Exception(
          String.format("Error [%s] while calling initializing script with init().",
              e.getMessage()),
          e);
    }
  }

  public  JavaScripPredicate(PredicateExecutionContext predicateExecutionContext);

}