All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zeroturnaround.javarebel.integration.elcommons.BeanInfoManagerElCommonsCBP Maven / Gradle / Ivy

The newest version!
package org.zeroturnaround.javarebel.integration.elcommons;

import org.zeroturnaround.bundled.javassist.ClassPool;
import org.zeroturnaround.bundled.javassist.CtClass;
import org.zeroturnaround.bundled.javassist.CtMethod;
import org.zeroturnaround.bundled.javassist.NotFoundException;
import org.zeroturnaround.javarebel.integration.support.JavassistClassBytecodeProcessor;

public class BeanInfoManagerElCommonsCBP extends
		JavassistClassBytecodeProcessor {

	public void process(ClassPool cp, ClassLoader cl, CtClass ctClass) throws Exception {
		CtMethod m = null;
		try {
			m = 
				ctClass.getMethod(
			        "getProperty", 
			        "(Ljava/lang/String;Lorg/apache/commons/el/Logger;)Lorg/apache/commons/el/BeanInfoProperty;");

			m.setBody("{ checkInitialized($2);" + 
		    		"org.apache.commons.el.BeanInfoProperty beanInfoProperty = (org.apache.commons.el.BeanInfoProperty) mPropertyByName.get($1);" + 
	 
		    		"if (beanInfoProperty == null) {" +
		    		"    mInitialized = false;" + 
		    		"    java.beans.Introspector.flushFromCaches(mBeanClass);" + 
		    		"    this.checkInitialized($2);" + 
		    		"} " + 
		    		"return (org.apache.commons.el.BeanInfoProperty) mPropertyByName.get($1); }");
		}
		catch (NotFoundException e) {
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy