Examples of EFunHandler


Examples of erjang.EFunHandler

    /** a java.lang.Runnable can be used as a function of 0 arguments */
    if ((nargs == 0) && (real_object instanceof Runnable)) {
      final Runnable r = (Runnable) real_object;
      return EFunCG.get_fun_with_handler("java.lang.Runnable", "run", 0,
                    new EFunHandler() {
                        @Override
                        public EObject invoke(EProc proc, EObject[] args)
                                throws Pausable {
                            if (proc != owner)
                                throw new ErlangError(ERT.am_badfun, args);

                            r.run();
                            return ERT.am_ok;
                        }
                    }, getClass().getClassLoader());

    }

    /*
     * a java.util.Map can be used as a function with 1 argument to get a
     * value
     */
    if ((nargs == 1) && (real_object instanceof java.util.Map<?, ?>)) {
      final java.util.Map<?, ?> r = (java.util.Map<?, ?>) real_object;
      return EFunCG.get_fun_with_handler("java.util.Map", "get", 0,
        new EFunHandler() {
          @Override
          public EObject invoke(EProc self, EObject[] args)
              throws Pausable {
            if (self != owner)
              throw new ErlangError(ERT.am_badfun, args);
View Full Code Here

Examples of erjang.EFunHandler

            public Object invoke(Object proxy, final Method method, final Object[] args)
                throws Throwable {
             
              final Mailbox<Object> reply = new Mailbox<Object>(1);
             
              EFun job = EFunCG.get_fun_with_handler("erlang", "apply", 0, new EFunHandler() {
                @Override
                public EObject invoke(EProc proc, EObject[] _) throws Pausable {

                  EObject aa = JavaObject.box(proc, args);
                  EObject at = JavaObject.box(proc, method.getParameterTypes());
View Full Code Here

Examples of erjang.EFunHandler

    // TODO: we can make this much much faster!

    return EFunCG.get_fun_with_handler("java.lang.Object", f.toString(), arity,

    new EFunHandler() {
      @Override
      public EObject invoke(EProc proc, EObject[] args) throws Pausable {

        if (real_object == null) {
          throw new ErlangError(am_null_pointer_exception);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.