Annotation Interface PayloadInterception
String
or Payload
.
You can get information from the intercepted method like parameter values, the instance or the return value by declaring parameters annotated with
the annotations from the com.jprofiler.api.probe.injected.parameter package. You can also declare a parameter of type ProbeContext
to
open or close control objects or create payloads with enhanced functionality.
If you return a Payload
to specify control objects or custom event types you must declare a parameter of type ProbeContext
and create the returned object with
ProbeContext.createPayload(String, Object, Enum)
or ProbeContext.createPayloadWithDeferredName(Object, Enum)
. The invokeOn()
argument must be set
to InvocationType.ENTER
in that case.
If you create a Payload
with a deferred name because the payload name cannot be determined at method entry, you must declare a method directly below the current interception method,
annotate it with AdditionalInterception
where AdditionalInterception.value()
is set to InvocationType.EXIT
and return a String
from that method.
If you don't want to create a payload for the current invocation, the probe method can return null
.
-
Required Element Summary
Modifier and TypeRequired ElementDescriptionThe point at which the annotated probe method is invoked.Specifies the method that should be intercepted. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
If payloads should also be recorded if the method throws an exception.boolean
Indicates if your interception is reentrant.
-
Element Details
-
invokeOn
InvocationType invokeOnThe point at which the annotated probe method is invoked.- Returns:
- the invocation type
-
method
MethodSpec methodSpecifies the method that should be intercepted.- Returns:
- a method specification
-
-
-
reentrant
boolean reentrantIndicates if your interception is reentrant. Iffalse
, the probe method will not be called for recursive invocations of the intercepted method.If
true
, the payload name (and the other information inPayload
) returned by the subsequent inner calls will be used, but timing and call tree location will be used from the outermost call. You can useProbeContext.restartTiming()
andProbeContext.restartTimingAndLocation()
to customize this behavior. If you want to retain the name from outer calls you can useProbeContext.getOuterPayload()
.- Returns:
- if your probe method should be called for recursive invocations
- Default:
- false
-
exceptionPayloads
boolean exceptionPayloadsIf payloads should also be recorded if the method throws an exception. IfinvokeOn()
is set toInvocationType.EXCEPTION
orInvocationType.EXIT
, JProfiler will always record payloads for exceptional exits.- Returns:
- if payloads should be recorded for exceptional exits
- Default:
- false
-