Package mug.runtime

Examples of mug.runtime.JSObject


      @Override
      public Object invoke(Object ths, int argc, Object l0, Object l1, Object l2, Object l3, Object l4, Object l5, Object l6, Object l7, Object[] rest) throws Exception
      {
        // coerce path
        String qn = JSUtils.asString(l0);
        final JSObject obj = (JSObject) l1;
        Class javaClass = Class.forName(qn);
       
        return new ReflectedJSJavaObject(env, Proxy.newProxyInstance(javaClass.getClassLoader(),
          new Class[] { javaClass },
          new InvocationHandler() {
            public Object invoke(Object ths, Method method, Object[] args) throws Throwable {
              JSObject meth = (JSObject) obj.get(method.getName());
              return JSJavaUtils.coerceJavaType(meth.invoke(ths, args), method.getReturnType());
            }
          }));
      }
    };
   
    // exports library
    final JSObject exports = new JSObject(env) { {
      defineProperty("import", _import);
      defineProperty("Proxy", _Proxy);
     
      // default top-level java packages
      String[] pkgs = new String[] { "io", "nio", "lang", "util" };
View Full Code Here

TOP

Related Classes of mug.runtime.JSObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.