@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public static @interface Advice.OnMethodEnter
Indicates that this method should be inlined before the matched method is invoked. Any class must declare
at most one method with this annotation. The annotated method must be static. When instrumenting constructors,
the this
values can only be accessed for writing fields but not for reading fields or invoking methods.
The annotated method can return a value that is made accessible to another method annotated by Advice.OnMethodExit
.
Advice
,
Advice.Argument
,
Advice.This
Modifier and Type | Optional Element and Description |
---|---|
boolean |
inline
Determines if the annotated method should be inlined into the instrumented method or invoked from it.
|
boolean |
prependLineNumber
If set to
true , the instrumented method's line number information is adjusted such that stack traces generated within
this advice method appear as if they were generated within the first line of the instrumented method. |
Class<?> |
skipOn
Setting any non-primitive type allows to specify that the instrumented method should not be invoked if a
instanceof check
of the return value of this advice method is returned. |
Class<? extends Throwable> |
suppress
Indicates that this advice should suppress any
Throwable type being thrown during the advice's execution. |
public abstract boolean inline
true
if the annotated method should be inlined into the instrumented method.public abstract Class<?> skipOn
instanceof
check
of the return value of this advice method is returned. It is not allowed to specify a primitive type whereas specifying void
indicates that the instrumented method should never be skipped. This is the default behavior. Finally, it is possible to set this
property to Advice.DefaultValueOrTrue
where the instrumented method is not invoked if this advice method returns the return type's
default value, i.e. 0
for primitive types or null
for reference types. For a boolean
method, a return value of
true
indicates to skip the instrumented method.void
if the instrumented method should never be skipped, Advice.DefaultValueOrTrue
or any non-primitive type
if the instrumented method should be skipped upon returning any instance of the specified type.public abstract boolean prependLineNumber
true
, the instrumented method's line number information is adjusted such that stack traces generated within
this advice method appear as if they were generated within the first line of the instrumented method. If set to false
,
no line number information is made available for such stack traces.true
if this advice code should appear as if it was added within the first line of the instrumented method.Copyright © 2014–2016. All rights reserved.