Annotation Interface StubValue


@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface StubValue

A stub value represents the (boxed) default value of the intercepted method's return type. This value can only be assigned to a Object parameter. This annotation is useful to conditionally return a default value from a method when using an Object return type in combination with the RuntimeType annotation. The value is either representing null if a method returns a reference type or void or a boxed primitive of the return type representing the numeric value 0.

Important: Don't confuse this annotation with Advice.StubValue annotation. This annotation should be used only in combination with method delegation (MethodDelegation.to(...)). For Advice ASM visitor use alternative annotation from net.bytebuddy.asm.Advice package.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Binds the StubValue annotation.