Example usage for org.aspectj.apache.bcel.generic MethodGen setName

List of usage examples for org.aspectj.apache.bcel.generic MethodGen setName

Introduction

In this page you can find the example usage for org.aspectj.apache.bcel.generic MethodGen setName.

Prototype

public void setName(String name) 

Source Link

Usage

From source file:br.jabuti.probe.mobiledevice.HostProbeInsert.java

License:Open Source License

protected JavaClass xdoMethodInstrument(JavaClass java_class)
        throws InvalidInstructionException, InvalidStackArgument {

    ClassGen cg = new ClassGen(java_class);
    ConstantPoolGen cp = cg.getConstantPool();

    Method[] methods = cg.getMethods();

    for (int i = 0; i < methods.length; i++) {
        // only instrument the run() method
        if (!methods[i].getName().equals("run") || !methods[i].getSignature().equals("()V")) {
            continue;
        }//from www.ja va2s. c o  m

        MethodGen mg = new MethodGen(methods[i], cg.getClassName(), cp);
        mg.setName(MuAgent.runName);

        methods[i] = mg.getMethod();
    }
    cg.setMethods(methods);
    return (cg.getJavaClass());
}