Example usage for javax.script ScriptEngine eval

List of usage examples for javax.script ScriptEngine eval

Introduction

In this page you can find the example usage for javax.script ScriptEngine eval.

Prototype

public Object eval(Reader reader) throws ScriptException;

Source Link

Document

Same as eval(String) except that the source of the script is provided as a Reader

Usage

From source file:org.eclairjs.nashorn.sql.JSUDF5.java

@SuppressWarnings({ "null", "unchecked" })
@Override/*w  ww .j a v  a2 s. c  o m*/
public Object call(Object o, Object o2, Object o3, Object o4, Object o5) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF10.java

@SuppressWarnings({ "null", "unchecked" })
@Override//from   www . ja v a 2  s.  co  m
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF11.java

@SuppressWarnings({ "null", "unchecked" })
@Override//ww  w.  j a v a 2  s .com
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF12.java

@SuppressWarnings({ "null", "unchecked" })
@Override/*from w w  w  .j  a  va2 s  . co m*/
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF13.java

@SuppressWarnings({ "null", "unchecked" })
@Override/*from ww w  .j  a  v  a 2 s . c o m*/
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF14.java

@SuppressWarnings({ "null", "unchecked" })
@Override/*w  w w .  ja  v a 2  s .c om*/
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF15.java

@SuppressWarnings({ "null", "unchecked" })
@Override//from   w w  w.  j av a2s  .c om
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14, Object o15) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF7.java

@SuppressWarnings({ "null", "unchecked" })
@Override/* www .j  ava2s . c  o m*/
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7)
        throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF8.java

@SuppressWarnings({ "null", "unchecked" })
@Override// ww  w  .  j  ava2s  .  c  o m
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8)
        throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}

From source file:org.eclairjs.nashorn.sql.JSUDF9.java

@SuppressWarnings({ "null", "unchecked" })
@Override//  w w  w .j  a  v  a 2s.  com
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9) throws Exception {
    ScriptEngine e = NashornEngineSingleton.getEngine();
    if (this.fn == null) {
        this.fn = e.eval(func);
    }
    Invocable invocable = (Invocable) e;

    Object params[] = { this.fn, o, o2, o3, o4, o5, o6, o7, o8, o9 };

    if (this.args != null && this.args.length > 0) {
        params = ArrayUtils.addAll(params, this.args);
    }

    Object ret = invocable.invokeFunction("Utils_invoke", params);
    ret = this.castValueToReturnType(ret);
    return ret;
}