final BinderNut nut = (BinderNut)obj;
try{
return nut.eval();
}
catch(Exception e){
throw new ConfigurationException(e, nut.getTagLocation());
}
}
public Class getType(){
return Binder.class;
}
};
}
else{
try{
final Method mtd = type.getMethod("eval", null);
final Class rtype = mtd.getReturnType();
return new Evaluator(){
public Object eval(Object obj){
final Nut nut = (Nut)obj;
try{
final Object r = mtd.invoke(nut, null);
if(void.class.equals(rtype)){
return nut;
}
else return r;
}
catch(InvocationTargetException e){
throw new ConfigurationException(e.getTargetException(), nut.getTagLocation());
}
catch(Exception e){
throw new ConfigurationException(e, nut.getTagLocation());
}
}
public Class getType(){
return (void.class.equals(rtype)?type:rtype);
}