@Override
public void process(ClassPool classPool, ClassLoader classLoader, CtClass ctClass) throws Exception {
try {
CtClass rendererCtClass = classPool.get("javax.faces.render.Renderer");
if (ctClass.subclassOf(rendererCtClass)) {
CtClass[] ctInterfaces = ctClass.getInterfaces();
boolean hasInterface = false;
for (CtClass ctInterface : ctInterfaces) {
if ("javax.faces.event.SystemEventListener".equals(ctInterface.getName())) {
hasInterface = true;
break;
}
}
if (hasInterface) {
CtClass facesContextCtClass = classPool.get("javax.faces.context.FacesContext");
CtClass uiComponentCtClass = classPool.get("javax.faces.component.UIComponent");
try {
CtMethod encodeBeginMethod = ctClass.getDeclaredMethod("encodeBegin",
new CtClass[] { facesContextCtClass, uiComponentCtClass });
encodeBeginMethod.insertBefore(