JProfiler API

com.jprofiler.api.agent.interceptor
Class InterceptionMethod

java.lang.Object
  extended by com.jprofiler.api.agent.interceptor.InterceptionMethod

public class InterceptionMethod
extends java.lang.Object

Defines a single method that should be intercepted by an interceptor. You can define a method in a concrete class or a wildcard interception that intercepts all methods based on the method name an signature only. For wildcard interceptions, make sure to try to intercept uncommon method signatures only in order to reduce the instrumentation overhead. For example, intercepting getName() as a wildcard interception leads to many unwanted instrumentations.

The method signature is written in JVM format. This format is also used by JNI and is of the form:

 (argument-type*)return-type
 
and uses the JVM's representation of type signatures for both argument type and return type. The following table shows all type signatures:

TypeSignature
Zboolean
Bbyte
Cchar
Sshort
Iint
Jlong
Ffloat
Ddouble
L fully-qualified-class ;fully-qualified-class
[ typetype[]

The fully qualified class references have to be written with '/' package separators instead of the usual '.' package separators. There must be no spaces in a type signature.

For example, the Java method:

 long someMethod (int n, String s, int[] arr);
 
has the following type signature:
 (ILjava/lang/String;[I)J
 

See Also:
Interceptor

Constructor Summary
InterceptionMethod(java.lang.String methodName, java.lang.String methodSignature)
          Constructor for a wildcard method interception.
InterceptionMethod(java.lang.String className, java.lang.String methodName, java.lang.String methodSignature)
          Constructor for a method interception of a concrete class.
 
Method Summary
 java.lang.String getClassName()
          Returns the class name.
 java.lang.String getMethodName()
          Returns the method name.
 java.lang.String getMethodSignature()
          Returns the method signature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterceptionMethod

public InterceptionMethod(java.lang.String className,
                          java.lang.String methodName,
                          java.lang.String methodSignature)
Constructor for a method interception of a concrete class.

Parameters:
className - the fully qualified name of the class that contains the intercepted method. Can be written with '/' or '.' package separators. If null, this constructor is equivalent to InterceptionMethod(String, String).
methodName - the name of the intercepted method
methodSignature - the signature of the intercepted method in the JVM format explained above

InterceptionMethod

public InterceptionMethod(java.lang.String methodName,
                          java.lang.String methodSignature)
Constructor for a wildcard method interception. All classes are checked whether they contains such a method ans are instrumented accordingly.

Parameters:
methodName - the name of the intercepted method
methodSignature - the signature of the intercepted method in the JVM format explained above
Method Detail

getClassName

public java.lang.String getClassName()
Returns the class name.

Returns:
the class name

getMethodName

public java.lang.String getMethodName()
Returns the method name.

Returns:
the method name

getMethodSignature

public java.lang.String getMethodSignature()
Returns the method signature

Returns:
the method signature in the format explained above.

JProfiler API