Top Description Inners Methods
net.bytebuddy.implementation.bind.annotation

public @Interface StubValue

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:PARAMETER
Imports
net.bytebuddy.description.annotation.AnnotationDescription, net.bytebuddy.description.method.MethodDescription, .ParameterDescription, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.bind.MethodDelegationBinder, net.bytebuddy.implementation.bytecode.StackManipulation, net.bytebuddy.implementation.bytecode.assign.Assigner, net.bytebuddy.implementation.bytecode.constant.DefaultValue, .NullConstant, java.lang.annotation.*

A stub value represents the (boxed) default value of the intercepted method's return type. This value can only be assigned to a java.lang.Object parameter. This annotation is useful to conditionally return a default value from a method when using an java.lang.Object return type in combination with the net.bytebuddy.implementation.bind.annotation.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 Note

Don't confuse this annotation with net.bytebuddy.asm.Advice.StubValue or net.bytebuddy.asm.MemberSubstitution.StubValue. This annotation should be used with net.bytebuddy.implementation.MethodDelegation only.

See Also
net.bytebuddy.implementation.MethodDelegation, net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Method Summary

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString
net.bytebuddy.implementation.bind.annotation back to summary

public final Enum StubValue.Binder

extends Enum<StubValue.Binder>
implements TargetMethodAnnotationDrivenBinder.ParameterBinder<StubValue>
Class Inheritance
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder

Binds the net.bytebuddy.implementation.bind.annotation.StubValue annotation.

Field Summary

Modifier and TypeField and Description
public static final StubValue.Binder
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public MethodDelegationBinder.ParameterBinding<?>
bind(AnnotationDescription.Loadable<StubValue>
The annotation that was cause for the delegation to this argument binder.
annotation
,
MethodDescription
The intercepted source method.
source
,
ParameterDescription
Tge target parameter that is subject to be bound to intercepting the source method.
target
,
Implementation.Target
The target of the current implementation that is subject to this binding.
implementationTarget
,
Assigner
An assigner that can be used for applying the binding.
assigner
,
Assigner.Typing
The typing to apply.
typing
)

Implements net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.bind.

Creates a parameter binding for the given target parameter.
public Class<StubValue>
public static StubValue.Binder
public static StubValue.Binder[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final StubValue.Binder INSTANCE

The singleton instance.

Constructor Detail

Binderback to summary
private Binder()

Method Detail

bindback to summary
public MethodDelegationBinder.ParameterBinding<?> bind(AnnotationDescription.Loadable<StubValue> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner, Assigner.Typing typing)

Implements net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.bind.

Doc from net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.bind.

Creates a parameter binding for the given target parameter.

Parameters
annotation:AnnotationDescription.Loadable<StubValue>

The annotation that was cause for the delegation to this argument binder.

source:MethodDescription

The intercepted source method.

target:ParameterDescription

Tge target parameter that is subject to be bound to intercepting the source method.

implementationTarget:Implementation.Target

The target of the current implementation that is subject to this binding.

assigner:Assigner

An assigner that can be used for applying the binding.

typing:Assigner.Typing

The typing to apply.

Returns:MethodDelegationBinder.ParameterBinding<?>

A parameter binding for the requested target method parameter.

getHandledTypeback to summary
public Class<StubValue> getHandledType()

Implements net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.getHandledType.

Doc from net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.getHandledType.

The annotation type that is handled by this parameter binder.

Returns:Class<StubValue>

The java.lang.annotation.Annotation#annotationType() handled by this parameter binder.

valueOfback to summary
public static StubValue.Binder valueOf(String name)
valuesback to summary
public static StubValue.Binder[] values()