Search in sources :

Example 1 with TraceByReturnTypeMatchVisitor

use of com.newrelic.agent.instrumentation.context.TraceByReturnTypeMatchVisitor in project newrelic-java-agent by newrelic.

the class TraceByReturnTypeMatchVisitorTest method instrumentClass.

private InstrumentationContext instrumentClass(Class<?> clazz) throws IOException {
    InstrumentationContext context = new InstrumentationContext(null, clazz, clazz.getProtectionDomain());
    ClassReader reader = new ClassReader(clazz.getName());
    ClassVisitor visitor = new TraceByReturnTypeMatchVisitor().newClassMatchVisitor(clazz.getClassLoader(), clazz, reader, new ClassWriter(0), context);
    reader.accept(visitor, 0);
    return context;
}
Also used : InstrumentationContext(com.newrelic.agent.instrumentation.context.InstrumentationContext) ClassReader(org.objectweb.asm.ClassReader) ClassVisitor(org.objectweb.asm.ClassVisitor) TraceByReturnTypeMatchVisitor(com.newrelic.agent.instrumentation.context.TraceByReturnTypeMatchVisitor) ClassWriter(org.objectweb.asm.ClassWriter)

Aggregations

InstrumentationContext (com.newrelic.agent.instrumentation.context.InstrumentationContext)1 TraceByReturnTypeMatchVisitor (com.newrelic.agent.instrumentation.context.TraceByReturnTypeMatchVisitor)1 ClassReader (org.objectweb.asm.ClassReader)1 ClassVisitor (org.objectweb.asm.ClassVisitor)1 ClassWriter (org.objectweb.asm.ClassWriter)1