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

public @Interface DefaultMethod

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:PARAMETER
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.annotation.AnnotationDescription, net.bytebuddy.description.method.MethodDescription, .MethodList, .ParameterDescription, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.dynamic.TargetType, net.bytebuddy.implementation.Implementation, .MethodAccessorFactory, net.bytebuddy.implementation.bind.MethodDelegationBinder, net.bytebuddy.implementation.bytecode.StackManipulation, net.bytebuddy.implementation.bytecode.assign.Assigner, net.bytebuddy.implementation.bytecode.constant.MethodConstant, .NullConstant, net.bytebuddy.implementation.bytecode.member.FieldAccess, net.bytebuddy.jar.asm.MethodVisitor, java.lang.annotation.*, java.lang.reflect.Method

A parameter with this annotation is assigned an instance of Method which invokes a default method implementation of this method. If such a method is not available, this annotation causes that this delegation target cannot be bound unless DefaultMethod#nullIfImpossible() is set to true. The method is declared as public and is invokable unless the instrumented type itself is not visible. Note that requesting such a method exposes the super method to reflection.
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
DefaultMethod.Binder

A binder for the DefaultMethod annotation.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if this method instance should be cached.
cached
()

Indicates if the instance assigned to this parameter should be stored in a static field for reuse.

public boolean

Returns:

true if null should be assigned if no valid method can be assigned.
nullIfImpossible
()

Indicates that null should be assigned to this parameter if no default method is invokable.

public boolean

Returns:

true if this method should be looked up using an java.security.AccessController.
privileged
()

Indicates if the instance assigned to this parameter should be looked up using an java.security.AccessController.

public Class<?>

Returns:

The type declaring the method to invoke or TargetType to indicate that the instrumented method declared the method.
targetType
()

Specifies an explicit type that declares the default method to invoke.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

cachedback to summary
public boolean cached()

Indicates if the instance assigned to this parameter should be stored in a static field for reuse.

Returns:boolean

true if this method instance should be cached.

nullIfImpossibleback to summary
public boolean nullIfImpossible()

Indicates that null should be assigned to this parameter if no default method is invokable.

Returns:boolean

true if null should be assigned if no valid method can be assigned.

privilegedback to summary
public boolean privileged()

Indicates if the instance assigned to this parameter should be looked up using an java.security.AccessController.

Returns:boolean

true if this method should be looked up using an java.security.AccessController.

targetTypeback to summary
public Class<?> targetType()

Specifies an explicit type that declares the default method to invoke.

Returns:Class<?>

The type declaring the method to invoke or TargetType to indicate that the instrumented method declared the method.

net.bytebuddy.implementation.bind.annotation back to summary

public final Enum DefaultMethod.Binder

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

A binder for the DefaultMethod annotation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
DefaultMethod.Binder.DelegationMethod

Loads the delegation method constant onto the stack.

protected static interface
DefaultMethod.Binder.MethodLocator

A method locator is responsible for creating the super method call.

Field Summary

Modifier and TypeField and Description
private static final MethodDescription.InDefinedShape
public static final DefaultMethod.Binder
INSTANCE

The singleton instance.

private static final MethodDescription.InDefinedShape
private static final MethodDescription.InDefinedShape
private static final MethodDescription.InDefinedShape

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public MethodDelegationBinder.ParameterBinding<?>
bind(final AnnotationDescription.Loadable<DefaultMethod>
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<DefaultMethod>
public static DefaultMethod.Binder
public static DefaultMethod.Binder[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CACHEDback to summary
private static final MethodDescription.InDefinedShape CACHED

The DefaultMethod#cached() property.

INSTANCEback to summary
public static final DefaultMethod.Binder INSTANCE

The singleton instance.

NULL_IF_IMPOSSIBLEback to summary
private static final MethodDescription.InDefinedShape NULL_IF_IMPOSSIBLE

The DefaultMethod#nullIfImpossible() property.

PRIVILEGEDback to summary
private static final MethodDescription.InDefinedShape PRIVILEGED

The DefaultMethod#privileged() property.

TARGET_TYPEback to summary
private static final MethodDescription.InDefinedShape TARGET_TYPE

The DefaultMethod#targetType() property.

Constructor Detail

Binderback to summary
private Binder()

Method Detail

bindback to summary
public MethodDelegationBinder.ParameterBinding<?> bind(final AnnotationDescription.Loadable<DefaultMethod> 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<DefaultMethod>

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<DefaultMethod> 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<DefaultMethod>

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

valueOfback to summary
public static DefaultMethod.Binder valueOf(String name)
valuesback to summary
public static DefaultMethod.Binder[] values()
net.bytebuddy.implementation.bind.annotation back to summary

protected Class DefaultMethod.Binder.DelegationMethod

extends Object
implements StackManipulation
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.DelegationMethod
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.StackManipulation
Annotations
@Enhance

Loads the delegation method constant onto the stack.

Field Summary

Modifier and TypeField and Description
private final boolean
cached

true if the method constant should be cached.

private final boolean
privileged

true if the method should be looked up using an java.security.AccessController.

private final Implementation.SpecialMethodInvocation
specialMethodInvocation

The special method invocation that represents the super method call.

Constructor Summary

AccessConstructor and Description
protected
DelegationMethod(Implementation.SpecialMethodInvocation
The special method invocation that represents the super method call.
specialMethodInvocation
,
boolean
true if the method constant should be cached.
cached
,
boolean
true if the method should be looked up using an java.security.AccessController.
privileged
)

Creates a new delegation method.

Method Summary

Modifier and TypeMethod and Description
public StackManipulation.Size
apply(MethodVisitor
The method visitor used to write the method implementation to.
methodVisitor
,
Implementation.Context
The context of the current implementation.
implementationContext
)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.
public boolean
isValid()

Implements net.bytebuddy.implementation.bytecode.StackManipulation.isValid.

Determines if this stack manipulation is valid.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedback to summary
private final boolean cached

true if the method constant should be cached.

privilegedback to summary
private final boolean privileged

true if the method should be looked up using an java.security.AccessController.

specialMethodInvocationback to summary
private final Implementation.SpecialMethodInvocation specialMethodInvocation

The special method invocation that represents the super method call.

Constructor Detail

DelegationMethodback to summary
protected DelegationMethod(Implementation.SpecialMethodInvocation specialMethodInvocation, boolean cached, boolean privileged)

Creates a new delegation method.

Parameters
specialMethodInvocation:Implementation.SpecialMethodInvocation

The special method invocation that represents the super method call.

cached:boolean

true if the method constant should be cached.

privileged:boolean

true if the method should be looked up using an java.security.AccessController.

Method Detail

applyback to summary
public StackManipulation.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext)

Implements net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.apply.

Applies the stack manipulation that is described by this instance.

Parameters
methodVisitor:MethodVisitor

The method visitor used to write the method implementation to.

implementationContext:Implementation.Context

The context of the current implementation.

Returns:StackManipulation.Size

The changes to the size of the operand stack that are implied by this stack manipulation.

isValidback to summary
public boolean isValid()

Implements net.bytebuddy.implementation.bytecode.StackManipulation.isValid.

Doc from net.bytebuddy.implementation.bytecode.StackManipulation.isValid.

Determines if this stack manipulation is valid.

Returns:boolean

If false, this manipulation cannot be applied and should throw an exception.

net.bytebuddy.implementation.bind.annotation back to summary

protected Interface DefaultMethod.Binder.MethodLocator

Known Direct Implementers
net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.ForImplicitType, net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.ForExplicitType

A method locator is responsible for creating the super method call.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
DefaultMethod.Binder.MethodLocator.ForExplicitType

A method locator for an explicit target type.

public static enum
DefaultMethod.Binder.MethodLocator.ForImplicitType

A method locator for an implicit target type.

Method Summary

Modifier and TypeMethod and Description
public Implementation.SpecialMethodInvocation

Returns:

A special method invocation that represents the super call of this binding.
resolve
(Implementation.Target
The implementation target.
implementationTarget
,
MethodDescription
The method being instrumented.
source
)

Resolves the special method invocation to this target.

Method Detail

resolveback to summary
public Implementation.SpecialMethodInvocation resolve(Implementation.Target implementationTarget, MethodDescription source)

Resolves the special method invocation to this target.

Parameters
implementationTarget:Implementation.Target

The implementation target.

source:MethodDescription

The method being instrumented.

Returns:Implementation.SpecialMethodInvocation

A special method invocation that represents the super call of this binding.

net.bytebuddy.implementation.bind.annotation back to summary

public Class DefaultMethod.Binder.MethodLocator.ForExplicitType

extends Object
implements MethodLocator
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.ForExplicitType
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator
Annotations
@Enhance

A method locator for an explicit target type.

Field Summary

Modifier and TypeField and Description
private final TypeDescription
typeDescription

The explicit target type.

Constructor Summary

AccessConstructor and Description
protected
ForExplicitType(TypeDescription
The explicit target type.
typeDescription
)

Creates a method locator for an explicit target.

Method Summary

Modifier and TypeMethod and Description
public Implementation.SpecialMethodInvocation
resolve(Implementation.Target
The implementation target.
implementationTarget
,
MethodDescription
The method being instrumented.
source
)

Implements net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.resolve.

Resolves the special method invocation to this target.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

typeDescriptionback to summary
private final TypeDescription typeDescription

The explicit target type.

Constructor Detail

ForExplicitTypeback to summary
protected ForExplicitType(TypeDescription typeDescription)

Creates a method locator for an explicit target.

Parameters
typeDescription:TypeDescription

The explicit target type.

Method Detail

resolveback to summary
public Implementation.SpecialMethodInvocation resolve(Implementation.Target implementationTarget, MethodDescription source)

Implements net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.resolve.

Resolves the special method invocation to this target.

Parameters
implementationTarget:Implementation.Target

The implementation target.

source:MethodDescription

The method being instrumented.

Returns:Implementation.SpecialMethodInvocation

A special method invocation that represents the super call of this binding.

net.bytebuddy.implementation.bind.annotation back to summary

public final Enum DefaultMethod.Binder.MethodLocator.ForImplicitType

extends Enum<DefaultMethod.Binder.MethodLocator.ForImplicitType>
implements MethodLocator
Class Inheritance
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator

A method locator for an implicit target type.

Field Summary

Modifier and TypeField and Description
public static final DefaultMethod.Binder.MethodLocator.ForImplicitType
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Implementation.SpecialMethodInvocation
resolve(Implementation.Target
The implementation target.
implementationTarget
,
MethodDescription
The method being instrumented.
source
)

Implements net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.resolve.

Resolves the special method invocation to this target.
public static DefaultMethod.Binder.MethodLocator.ForImplicitType
public static DefaultMethod.Binder.MethodLocator.ForImplicitType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final DefaultMethod.Binder.MethodLocator.ForImplicitType INSTANCE

The singleton instance.

Constructor Detail

ForImplicitTypeback to summary
private ForImplicitType()

Method Detail

resolveback to summary
public Implementation.SpecialMethodInvocation resolve(Implementation.Target implementationTarget, MethodDescription source)

Implements net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.DefaultMethod.Binder.MethodLocator.resolve.

Resolves the special method invocation to this target.

Parameters
implementationTarget:Implementation.Target

The implementation target.

source:MethodDescription

The method being instrumented.

Returns:Implementation.SpecialMethodInvocation

A special method invocation that represents the super call of this binding.

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