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

com.googlecode.gwt.test.internal.Patcher Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.internal;

import javassist.CtClass;
import javassist.CtMethod;

/**
 * 

* Interface for a class patcher. *

*

*

* A patcher provides custom bodies (implementations) for the methods of a class. Patchers are used * to replace methods implementations which are not suitable for a JVM (typically, those containing * Javascript code) by valid Java ones. *

*

*

* It's based on javassist framework to make bytecode manipulation simple. *

*

*

* Although the framework provides some generic implementations of this interface (which should * permit to produce iso-functional, Java compliant code in the majority of cases), it is possible * for you to create your own patcher (specifically, if you're writing your own GWT component class) * if the default patching mechanisms doesn't suit your needs. *

*

*

* The custom patchers used to test an application are configured in the * META-INF\gwt-test-utils.properties file. *

* * @author Gael Lazzari */ interface Patcher { /** * Finalizes the patching mechanism for the specified class. * * @param c the javassist representation for the current class to patch. * @throws Exception If any error occurs during the finalization. */ void finalizeClass(CtClass c) throws Exception; /** * Returns the new body for the specified method. * * @param m the method to patch * @return the new java code of the method, or null if the method should not be modified. * @throws Exception If any error occurs when getting the new java code. */ String getNewBody(CtMethod m) throws Exception; /** * Initializes patching for the specified class. If you want to add some member to a class, or * modify any existing constructor, you should do it during this initialization phase. * * @param c the javassist representation for the current class to patch. * @throws Exception If any error occurs during the initialization. */ void initClass(CtClass c) throws Exception; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy