/** * Transform 1 argument get method : * <code>public <T> T get(Contextual<T> contextual);</code> * * @param classPool the class pool * @param ctClass the ct class * @throws CannotCompileException the cannot compile exception * @throws NotFoundException the not found exception */ public static void transformGet1(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException { CtMethod methGet1 = ctClass.getDeclaredMethod("get", new CtClass[] { classPool.get("javax.enterprise.context.spi.Contextual") }); methGet1.insertAfter(getRegistrationCode()); }
/** * Transform 2 arguments get method : * <code>public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext);</code> * * @param classPool the class pool * @param ctClass the ct class * @throws CannotCompileException the cannot compile exception * @throws NotFoundException the not found exception */ public static void transformGet2(ClassPool classPool, CtClass ctClass) throws CannotCompileException, NotFoundException { CtMethod methGet2 = ctClass.getDeclaredMethod("get", new CtClass[] { classPool.get("javax.enterprise.context.spi.Contextual"), classPool.get("javax.enterprise.context.spi.CreationalContext"), }); methGet2.insertAfter(getRegistrationCode()); }