@Test public void testUnwrapList() throws ScriptException, NoSuchMethodException { engine.eval("function test() { return ['science', 'society']; }"); ScriptObjectMirror object = (ScriptObjectMirror) ((Invocable) engine).invokeFunction("test"); List<Object> list = ScriptObjectMirrors.unwrapList(object); assertEquals("science", list.get(0)); assertEquals("society", list.get(1)); }
public static List<Object> unwrapList(ScriptObjectMirror jso) { if (!jso.isArray()) { throw new IllegalArgumentException("JavaScript input is not an Array!"); } List<Object> l = new ArrayList<>(); for (Object o : jso.values()) { if (o instanceof ScriptObjectMirror) { l.add(unwrap((ScriptObjectMirror) o)); } else { l.add(o); } } return l; }
ScriptObjectMirrors { public static List<Object> unwrapList(ScriptObjectMirror jso) { if (!jso.isArray()) { throw new IllegalArgumentException("JavaScript input is not an Array!"); } List<Object> l = new ArrayList<>(); for (Object o : jso.values()) { if (o instanceof ScriptObjectMirror) { l.add(unwrap((ScriptObjectMirror) o)); } else { l.add(o); } } return l; } }
ScriptObjectMirrors { public static List<Object> unwrapList(ScriptObjectMirror jso) { if (!jso.isArray()) { throw new IllegalArgumentException("JavaScript input is not an Array!"); } List<Object> l = new ArrayList<>(); for (Object o : jso.values()) { if (o instanceof ScriptObjectMirror) { l.add(unwrap((ScriptObjectMirror) o)); } else { l.add(o); } } return l; } private  ScriptObjectMirrors(); }
ScriptObjectMirrors { public static List<Object> unwrapList(ScriptObjectMirror jso) { if (!jso.isArray()) { throw new IllegalArgumentException("JavaScript input is not an Array!"); } List<Object> l = new ArrayList<>(); for (Object o : jso.values()) { if (o instanceof ScriptObjectMirror) { l.add(unwrap((ScriptObjectMirror) o)); } else { l.add(o); } } return l; } private  ScriptObjectMirrors(); static Object unwrap(ScriptObjectMirror jso); static List<Object> unwrapList(ScriptObjectMirror jso); static Map<String, Object> unwrapMap(ScriptObjectMirror jso); static Calendar unwrapDate(ScriptObjectMirror jso); static Object wrap(Map<String, Object> map); }
ScriptObjectMirrors { public static List<Object> unwrapList(ScriptObjectMirror jso) { if (!jso.isArray()) { throw new IllegalArgumentException("JavaScript input is not an Array!"); } List<Object> l = new ArrayList<>(); for (Object o : jso.values()) { if (o instanceof ScriptObjectMirror) { l.add(unwrap((ScriptObjectMirror) o)); } else { l.add(o); } } return l; } private  ScriptObjectMirrors(); static Object unwrap(ScriptObjectMirror jso); static List<Object> unwrapList(ScriptObjectMirror jso); static Map<String, Object> unwrapMap(ScriptObjectMirror jso); static Calendar unwrapDate(ScriptObjectMirror jso); static Object wrap(Map<String, Object> map);  }