예제 #1
0
 public static void generateResolvable(Class ownerClass, int id, Method method, boolean isStatic) {
   Method nonProxiedMethod = new Method(getNonProxiedMethodName(method), method.getDescriptor());
   generateResolvable(
       ownerClass.getClassLoader(),
       getResolvableName(id, Type.getType(ownerClass)),
       ownerClass,
       nonProxiedMethod,
       nonProxiedMethod.getArgumentTypes(),
       isStatic,
       getKeyTransformers(ownerClass, method));
 }
예제 #2
0
  private static TransformGenerator[] getKeyTransformers(Class ownerClass, Method method) {
    TransformGeneratorFactory tgf = TransformGeneratorFactoryImpl.getInstance();

    Class[] params =
        CodegenHelper.getClasses(ownerClass.getClassLoader(), method.getArgumentTypes());
    Annotation[][] annotations;
    try {
      annotations =
          ownerClass.getDeclaredMethod(method.getName(), params).getParameterAnnotations();
    } catch (NoSuchMethodException e) {
      throw new IllegalStateException(e);
    }

    TransformGenerator[] tg = new TransformGenerator[params.length];
    for (int i = 0; i < params.length; i++) {
      tg[i] = tgf.forArgument(annotations[i], params[i]);
    }
    return tg;
  }