/** 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);