private CtMethod createDelegateMethod(Class<?> interface1, CtClass cc, Class<?> scriptHelperClass, CtMethod method, DelegateCode delegateCodeAnnotation) throws Exception { StringBuffer code= new StringBuffer(); String params= createParameters(method, code); String customCode= null; CtClass returnType= method.getReturnType(); String body= delegateStrategy.createMethodBody(toJavaMethod(interface1, method), params); if (body == null) { if (delegateCodeAnnotation != null && !delegateCodeAnnotation.eval().isEmpty()) code.append("$eval$(\"" + delegateCodeAnnotation.eval() + "\", this);"); else { customCode= delegateStrategy.createMethodCall(toJavaMethod(interface1, method), params); code.append("$eval$(\"" + customCode + "\", this);"); } body= code.toString(); body= configureEvaluation(interface1, scriptHelperClass, method, body, returnType); } body= "{" + body + "}"; CtMethod ctMethod= CtNewMethod.make(AccessFlag.PUBLIC, returnType, method.getName(), method.getParameterTypes(), method.getExceptionTypes(), body, cc); return ctMethod; }