예제 #1
0
  public static CtClass makeInvocationClassNoCtors(
      AOPClassPool pool,
      boolean makeInnerClass,
      CtClass outerClass,
      String className,
      CtClass superInvocation)
      throws CannotCompileException, NotFoundException {
    CtClass untransformable = pool.get("org.jboss.aop.instrument.Untransformable");

    CtClass invocation;
    if (makeInnerClass) {
      // Strip away the package from classname
      String innerClassName = className.substring(className.lastIndexOf('.') + 1);
      defrostClassIfExists(pool, outerClass.getName() + "$" + innerClassName);

      // Only static nested classes are supported
      boolean classStatic = true;
      invocation = TransformerCommon.makeNestedClass(outerClass, innerClassName, classStatic);
      invocation.setSuperclass(superInvocation);
    } else {
      defrostClassIfExists(pool, className);
      invocation = TransformerCommon.makeClass(pool, className, superInvocation);
    }

    invocation.addInterface(untransformable);
    return invocation;
  }