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

public @Interface DefaultMethodHandle

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, net.bytebuddy.implementation.bind.MethodDelegationBinder, net.bytebuddy.implementation.bytecode.assign.Assigner, net.bytebuddy.implementation.bytecode.constant.NullConstant, net.bytebuddy.utility.JavaType, java.lang.annotation.*

A parameter with this annotation is assigned an instance of java.lang.invoke.MethodHandle 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 DefaultMethodHandle#nullIfImpossible() is set to true. Note that requesting such a method exposes the default method to reflective access.
See Also
net.bytebuddy.implementation.MethodDelegation, TargetMethodAnnotationDrivenBinder

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
DefaultMethodHandle.Binder

A binder for the DefaultMethodHandle annotation.

Method Summary

Modifier and TypeMethod and Description
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 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

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.

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 DefaultMethodHandle.Binder

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

A binder for the DefaultMethodHandle annotation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface
DefaultMethodHandle.Binder.MethodLocator

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

Field Summary

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

The singleton instance.

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<DefaultMethodHandle>
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<DefaultMethodHandle>
public static DefaultMethodHandle.Binder
public static DefaultMethodHandle.Binder[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final DefaultMethodHandle.Binder INSTANCE

The singleton instance.

NULL_IF_IMPOSSIBLEback to summary
private static final MethodDescription.InDefinedShape NULL_IF_IMPOSSIBLE

The DefaultMethodHandle#nullIfImpossible() property.

TARGET_TYPEback to summary
private static final MethodDescription.InDefinedShape TARGET_TYPE

The DefaultMethodHandle#targetType() property.

Constructor Detail

Binderback to summary
private Binder()

Method Detail

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

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

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

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

protected Interface DefaultMethodHandle.Binder.MethodLocator

Known Direct Implementers
net.bytebuddy.implementation.bind.annotation.DefaultMethodHandle.Binder.MethodLocator.ForImplicitType, net.bytebuddy.implementation.bind.annotation.DefaultMethodHandle.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
DefaultMethodHandle.Binder.MethodLocator.ForExplicitType

A method locator for an explicit target type.

public static enum
DefaultMethodHandle.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 DefaultMethodHandle.Binder.MethodLocator.ForExplicitType

extends Object
implements MethodLocator
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bind.annotation.DefaultMethodHandle.Binder.MethodLocator.ForExplicitType
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.DefaultMethodHandle.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.DefaultMethodHandle.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.DefaultMethodHandle.Binder.MethodLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.DefaultMethodHandle.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 DefaultMethodHandle.Binder.MethodLocator.ForImplicitType

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

A method locator for an implicit target type.

Field Summary

Modifier and TypeField and Description
public static final DefaultMethodHandle.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.DefaultMethodHandle.Binder.MethodLocator.resolve.

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

Field Detail

INSTANCEback to summary
public static final DefaultMethodHandle.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.DefaultMethodHandle.Binder.MethodLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.DefaultMethodHandle.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 DefaultMethodHandle.Binder.MethodLocator.ForImplicitType valueOf(String name)
valuesback to summary
public static DefaultMethodHandle.Binder.MethodLocator.ForImplicitType[] values()