public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, String body) { return addMethod(name, mod, rt, pts, null, body); }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, String body) { return addMethod(name, mod, rt, pts, null, body); }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, String body) { return addMethod(name, mod, rt, pts, null, body); }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, String body) { return addMethod(name, mod, rt, pts, null, body); }
public ClassGenerator addMethod(Method m) { addMethod(m.getName(), m); return this; }
public ClassGenerator addMethod(Method m) { addMethod(m.getName(), m); return this; }
public ClassGenerator addMethod(Method m) { addMethod(m.getName(), m); return this; }
public ClassGenerator addMethod(Method m) { addMethod(m.getName(), m); return this; }
public ClassGenerator addMethod(String name, Method m) { String desc = name + ReflectUtils.getDescWithoutMethodName(m); addMethod(':' + desc); if( mCopyMethods == null ) mCopyMethods = new ConcurrentHashMap<String, Method>(8); mCopyMethods.put(desc, m); return this; }
public ClassGenerator addMethod(String name, Method m) { String desc = name + ReflectUtils.getDescWithoutMethodName(m); addMethod(':' + desc); if (mCopyMethods == null) mCopyMethods = new ConcurrentHashMap<String, Method>(8); mCopyMethods.put(desc, m); return this; }
public ClassGenerator addMethod(String name, Method m) { String desc = name + ReflectUtils.getDescWithoutMethodName(m); addMethod(':' + desc); if (mCopyMethods == null) mCopyMethods = new ConcurrentHashMap<String, Method>(8); mCopyMethods.put(desc, m); return this; }
public ClassGenerator addMethod(String name, Method m) { String desc = name + ReflectUtils.getDescWithoutMethodName(m); addMethod(':' + desc); if( mCopyMethods == null ) mCopyMethods = new ConcurrentHashMap<String, Method>(8); mCopyMethods.put(desc, m); return this; }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, Class<?>[] ets, String body) { StringBuilder sb = new StringBuilder(); sb.append(modifier(mod)).append(' ').append(ReflectUtils.getName(rt)).append(' ').append(name); sb.append('('); for (int i = 0; i < pts.length; i++) { if (i > 0) sb.append(','); sb.append(ReflectUtils.getName(pts[i])); sb.append(" arg").append(i); } sb.append(')'); if (ets != null && ets.length > 0) { sb.append(" throws "); for (int i = 0; i < ets.length; i++) { if (i > 0) sb.append(','); sb.append(ReflectUtils.getName(ets[i])); } } sb.append('{').append(body).append('}'); return addMethod(sb.toString()); }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, Class<?>[] ets, String body) { StringBuilder sb = new StringBuilder(); sb.append(modifier(mod)).append(' ').append(ReflectUtils.getName(rt)).append(' ').append(name); sb.append('('); for (int i = 0; i < pts.length; i++) { if (i > 0) sb.append(','); sb.append(ReflectUtils.getName(pts[i])); sb.append(" arg").append(i); } sb.append(')'); if (ets != null && ets.length > 0) { sb.append(" throws "); for (int i = 0; i < ets.length; i++) { if (i > 0) sb.append(','); sb.append(ReflectUtils.getName(ets[i])); } } sb.append('{').append(body).append('}'); return addMethod(sb.toString()); }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, Class<?>[] ets, String body) { StringBuilder sb = new StringBuilder(); sb.append(modifier(mod)).append(' ').append(ReflectUtils.getName(rt)).append(' ').append(name); sb.append('('); for(int i=0;i<pts.length;i++) { if( i > 0 ) sb.append(','); sb.append(ReflectUtils.getName(pts[i])); sb.append(" arg").append(i); } sb.append(')'); if( ets != null && ets.length > 0 ) { sb.append(" throws "); for(int i=0;i<ets.length;i++) { if( i > 0 ) sb.append(','); sb.append(ReflectUtils.getName(ets[i])); } } sb.append('{').append(body).append('}'); return addMethod(sb.toString()); }
public ClassGenerator addMethod(String name, int mod, Class<?> rt, Class<?>[] pts, Class<?>[] ets, String body) { StringBuilder sb = new StringBuilder(); sb.append(modifier(mod)).append(' ').append(ReflectUtils.getName(rt)).append(' ').append(name); sb.append('('); for(int i=0;i<pts.length;i++) { if( i > 0 ) sb.append(','); sb.append(ReflectUtils.getName(pts[i])); sb.append(" arg").append(i); } sb.append(')'); if( ets != null && ets.length > 0 ) { sb.append(" throws "); for(int i=0;i<ets.length;i++) { if( i > 0 ) sb.append(','); sb.append(ReflectUtils.getName(ets[i])); } } sb.append('{').append(body).append('}'); return addMethod(sb.toString()); }
String mn = method.getName(); if (Void.TYPE.equals(rt)) ccp.addMethod(mn, method.getModifiers(), rt, method.getParameterTypes(), method.getExceptionTypes(), "d" + ix + "." + mn + "($$);"); else ccp.addMethod(mn, method.getModifiers(), rt, method.getParameterTypes(), method.getExceptionTypes(), "return ($r)d" + ix + "." + mn + "($$);"); ccm.addDefaultConstructor(); ccm.setSuperClass(Mixin.class.getName()); ccm.addMethod("public Object newInstance(Object[] delegates){ return new " + micn + "($1); }"); Class<?> mixin = ccm.toClass(); return (Mixin) mixin.newInstance();
String mn = method.getName(); if (Void.TYPE.equals(rt)) ccp.addMethod(mn, method.getModifiers(), rt, method.getParameterTypes(), method.getExceptionTypes(), "d" + ix + "." + mn + "($$);"); else ccp.addMethod(mn, method.getModifiers(), rt, method.getParameterTypes(), method.getExceptionTypes(), "return ($r)d" + ix + "." + mn + "($$);"); ccm.addDefaultConstructor(); ccm.setSuperClass(Mixin.class.getName()); ccm.addMethod("public Object newInstance(Object[] delegates){ return new " + micn + "($1); }"); Class<?> mixin = ccm.toClass(); return (Mixin) mixin.newInstance();