1 package jfun.yan.xml; 2 3 import java.util.Arrays ; 4 5 import jfun.yan.function.Function; 6 7 final class NutsFunction2Function implements Function { 8 private final NutsFunction nfun; 9 private final Class [] param_types; 10 11 NutsFunction2Function(NutsFunction nfun) { 12 this.nfun = nfun; 13 this.param_types = getObjectTypes(nfun.getParameterCount()); 14 } 15 private static Class [] getObjectTypes(int k){ 16 final Class [] ret = new Class [k]; 17 Arrays.fill(ret, Object .class); 18 return ret; 19 } 20 public boolean isConcrete() { 21 return false; 22 } 23 24 public Class getReturnType() { 25 final Class ret = nfun.getReturnType(); 26 if(ret==null) 27 return Object .class; 28 else 29 return ret; 30 } 31 32 public Class [] getParameterTypes() { 33 return param_types; 34 } 35 36 public Object call(Object [] args){ 37 return NutsUtils.callFunction(nfun, args); 38 } 39 40 public String getName() { 41 return nfun.getName(); 42 } 43 44 } 45 | Popular Tags |