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

public @Interface Super

extends Annotation
Annotations
@Documented
@Retention:RUNTIME
@Target:PARAMETER
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.annotation.AnnotationDescription, net.bytebuddy.description.enumeration.EnumerationDescription, net.bytebuddy.description.method.MethodDescription, .MethodList, .ParameterDescription, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.dynamic.TargetType, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.auxiliary.TypeProxy, net.bytebuddy.implementation.bind.MethodDelegationBinder, net.bytebuddy.implementation.bytecode.StackManipulation, net.bytebuddy.implementation.bytecode.assign.Assigner, java.lang.annotation.*, java.util.Arrays

Parameters that are annotated with this annotation are assigned an instance of an auxiliary proxy type that allows calling any super methods of the instrumented type where the parameter type must be a super type of the instrumented type. The proxy type will be a direct subclass of the parameter's type such as for example a specific interface.

 

Obviously, the proxy type must be instantiated before it is assigned to the intercepting method's parameter. For this purpose, two strategies are available which can be specified by setting the Super#strategy() parameter which can be assigned:
  1. net.bytebuddy.implementation.bind.annotation.Super.Instantiation#CONSTRUCTOR: A constructor call is made where Super#constructorParameters() determines the constructor's signature. Any constructor parameter is assigned the parameter's default value when the constructor is called. Calling the default constructor is the preconfigured strategy.
  2. net.bytebuddy.implementation.bind.annotation.Super.Instantiation#UNSAFE: The proxy is created by making use of Java's sun.reflect.ReflectionFactory which is however not a public API which is why it should be used with care. No constructor is called when this strategy is used. If this option is set, the Super#constructorParameters() parameter is ignored.
Note that when for example intercepting a type Foo that implements some interface Bar, the proxy type will only implement Bar and therefore extend java.lang.Object what allows for calling the default constructor on the proxy. This implies that an interception by some method qux(@Super Baz baz, @Super Bar bar) would cause the creation of two super call proxies, one extending Baz, the other extending Bar, give that both types are super types of Foo.

 

As an exception, no method calls to Object#finalize() are delegated by calling this method on the super-call proxy by default. If this is absolutely necessary, this can however be enabled by setting Super#ignoreFinalizer() to false.

 

If a method parameter is not a super type of the instrumented type, the method with the parameter that is annotated by #Super is not considered a possible delegation target.
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
public static enum
Super.Instantiation

Determines the instantiation of the proxy type.

Method Summary

Modifier and TypeMethod and Description
public Class<?>[]

Returns:

The parameter types of the constructor to be called.
constructorParameters
()

Defines the parameter types of the constructor to be called for the created super-call proxy type.

public boolean

Returns:

false if finalizer methods should be considered for super-call proxy type delegation.
ignoreFinalizer
()

If true, the proxy type will not implement super calls to Object#finalize() or any overridden methods.

public Class<?>

Returns:

The type of the proxy or an indicator type, i.e. void or TargetType.
proxyType
()

Determines the type that is implemented by the proxy.

public boolean

Returns:

true if the generated proxy should be java.io.Serializable.
serializableProxy
()

Determines if the generated proxy should be java.io.Serializable.

public Super.Instantiation

Returns:

The instantiation strategy for this proxy.
strategy
()

Determines how the supercall proxy type is instantiated.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

constructorParametersback to summary
public Class<?>[] constructorParameters()

Defines the parameter types of the constructor to be called for the created super-call proxy type.

Returns:Class<?>[]

The parameter types of the constructor to be called.

ignoreFinalizerback to summary
public boolean ignoreFinalizer()

If true, the proxy type will not implement super calls to Object#finalize() or any overridden methods.

Returns:boolean

false if finalizer methods should be considered for super-call proxy type delegation.

proxyTypeback to summary
public Class<?> proxyType()

Determines the type that is implemented by the proxy. When this value is set to its default value void, the proxy is created as an instance of the parameter's type. When it is set to TargetType, it is created as an instance of the generated class. Otherwise, the proxy type is set to the given value.

Returns:Class<?>

The type of the proxy or an indicator type, i.e. void or TargetType.

serializableProxyback to summary
public boolean serializableProxy()

Determines if the generated proxy should be java.io.Serializable. If the annotated type already is serializable, such an explicit specification is not required.

Returns:boolean

true if the generated proxy should be java.io.Serializable.

strategyback to summary
public Super.Instantiation strategy()

Determines how the supercall proxy type is instantiated.

Returns:Super.Instantiation

The instantiation strategy for this proxy.

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

public final Enum Super.Binder

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

A binder for handling the net.bytebuddy.implementation.bind.annotation.Super annotation.
See Also
TargetMethodAnnotationDrivenBinder

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface
Super.Binder.TypeLocator

Locates the type which should be the base type of the created proxy.

Field Summary

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

The singleton instance.

private static final MethodDescription.InDefinedShape
PROXY_TYPE

A reference to the proxy type property.

private static final MethodDescription.InDefinedShape
STRATEGY

A method reference to the strategy property.

Constructor Summary

AccessConstructor and Description
private

Method Summary

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

Field Detail

INSTANCEback to summary
public static final Super.Binder INSTANCE

The singleton instance.

PROXY_TYPEback to summary
private static final MethodDescription.InDefinedShape PROXY_TYPE

A reference to the proxy type property.

STRATEGYback to summary
private static final MethodDescription.InDefinedShape STRATEGY

A method reference to the strategy property.

Constructor Detail

Binderback to summary
private Binder()

Method Detail

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

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

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

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

protected Interface Super.Binder.TypeLocator

Known Direct Implementers
net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.ForInstrumentedType, net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.ForParameterType, net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.ForType

Locates the type which should be the base type of the created proxy.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Super.Binder.TypeLocator.ForInstrumentedType

A type locator that yields the instrumented type.

public static enum
Super.Binder.TypeLocator.ForParameterType

A type locator that yields the target parameter's type.

public static class
Super.Binder.TypeLocator.ForType

A type locator that returns a given type.

Method Summary

Modifier and TypeMethod and Description
public TypeDescription

Returns:

The proxy type.
resolve
(TypeDescription
The instrumented type.
instrumentedType
,
TypeDescription.Generic
The type of the target parameter.
parameterType
)

Resolves the target type.

Method Detail

resolveback to summary
public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription.Generic parameterType)

Resolves the target type.

Parameters
instrumentedType:TypeDescription

The instrumented type.

parameterType:TypeDescription.Generic

The type of the target parameter.

Returns:TypeDescription

The proxy type.

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

public final Enum Super.Binder.TypeLocator.ForInstrumentedType

extends Enum<Super.Binder.TypeLocator.ForInstrumentedType>
implements TypeLocator
Class Inheritance
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator

A type locator that yields the instrumented type.

Field Summary

Modifier and TypeField and Description
public static final Super.Binder.TypeLocator.ForInstrumentedType
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public TypeDescription
resolve(TypeDescription
The instrumented type.
instrumentedType
,
TypeDescription.Generic
The type of the target parameter.
parameterType
)

Implements net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Resolves the target type.
public static Super.Binder.TypeLocator.ForInstrumentedType
public static Super.Binder.TypeLocator.ForInstrumentedType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final Super.Binder.TypeLocator.ForInstrumentedType INSTANCE

The singleton instance.

Constructor Detail

ForInstrumentedTypeback to summary
private ForInstrumentedType()

Method Detail

resolveback to summary
public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription.Generic parameterType)

Implements net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Resolves the target type.

Parameters
instrumentedType:TypeDescription

The instrumented type.

parameterType:TypeDescription.Generic

The type of the target parameter.

Returns:TypeDescription

The proxy type.

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

public final Enum Super.Binder.TypeLocator.ForParameterType

extends Enum<Super.Binder.TypeLocator.ForParameterType>
implements TypeLocator
Class Inheritance
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator

A type locator that yields the target parameter's type.

Field Summary

Modifier and TypeField and Description
public static final Super.Binder.TypeLocator.ForParameterType
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public TypeDescription
resolve(TypeDescription
The instrumented type.
instrumentedType
,
TypeDescription.Generic
The type of the target parameter.
parameterType
)

Implements net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Resolves the target type.
public static Super.Binder.TypeLocator.ForParameterType
public static Super.Binder.TypeLocator.ForParameterType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final Super.Binder.TypeLocator.ForParameterType INSTANCE

The singleton instance.

Constructor Detail

ForParameterTypeback to summary
private ForParameterType()

Method Detail

resolveback to summary
public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription.Generic parameterType)

Implements net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Resolves the target type.

Parameters
instrumentedType:TypeDescription

The instrumented type.

parameterType:TypeDescription.Generic

The type of the target parameter.

Returns:TypeDescription

The proxy type.

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

public Class Super.Binder.TypeLocator.ForType

extends Object
implements TypeLocator
Class Inheritance
  • java.lang.Object
  • net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.ForType
All Implemented Interfaces
net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator
Annotations
@Enhance

A type locator that returns a given type.

Field Summary

Modifier and TypeField and Description
private final TypeDescription
typeDescription

The type to be returned upon resolution.

Constructor Summary

AccessConstructor and Description
protected
ForType(TypeDescription
The type to be returned upon resolution.
typeDescription
)

Creates a new type locator for a given type.

Method Summary

Modifier and TypeMethod and Description
protected static Super.Binder.TypeLocator

Returns:

The appropriate type locator.
of
(TypeDescription
The annotation's value.
typeDescription
)

Resolves a type locator based upon an annotation value.

public TypeDescription
resolve(TypeDescription
The instrumented type.
instrumentedType
,
TypeDescription.Generic
The type of the target parameter.
parameterType
)

Implements net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Resolves the target type.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

typeDescriptionback to summary
private final TypeDescription typeDescription

The type to be returned upon resolution.

Constructor Detail

ForTypeback to summary
protected ForType(TypeDescription typeDescription)

Creates a new type locator for a given type.

Parameters
typeDescription:TypeDescription

The type to be returned upon resolution.

Method Detail

ofback to summary
protected static Super.Binder.TypeLocator of(TypeDescription typeDescription)

Resolves a type locator based upon an annotation value.

Parameters
typeDescription:TypeDescription

The annotation's value.

Returns:Super.Binder.TypeLocator

The appropriate type locator.

resolveback to summary
public TypeDescription resolve(TypeDescription instrumentedType, TypeDescription.Generic parameterType)

Implements net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Doc from net.bytebuddy.implementation.bind.annotation.Super.Binder.TypeLocator.resolve.

Resolves the target type.

Parameters
instrumentedType:TypeDescription

The instrumented type.

parameterType:TypeDescription.Generic

The type of the target parameter.

Returns:TypeDescription

The proxy type.

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

public sealed Enum Super.Instantiation

extends Enum<Super.Instantiation>
Class Inheritance

Determines the instantiation of the proxy type.
See Also
net.bytebuddy.implementation.bind.annotation.Super

Field Summary

Modifier and TypeField and Description
public static final Super.Instantiation
CONSTRUCTOR

A proxy instance is instantiated by its constructor.

private static final MethodDescription.InDefinedShape
CONSTRUCTOR_PARAMETERS

A reference to the constructor parameters method.

private static final MethodDescription.InDefinedShape
IGNORE_FINALIZER

A reference to the ignore finalizer method.

private static final MethodDescription.InDefinedShape
SERIALIZABLE_PROXY

A reference to the serializable proxy method.

public static final Super.Instantiation
UNSAFE

A proxy is instantiated by calling JVM internal methods and without calling a constructor.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected abstract StackManipulation

Returns:

A stack manipulation representing this instance's instantiation strategy.
proxyFor
(TypeDescription
The type of the parameter that was annotated with net.bytebuddy.implementation.bind.annotation.Super
parameterType
,
Implementation.Target
The implementation target for the currently created type.
implementationTarget
,
AnnotationDescription.Loadable<Super>
The annotation that caused this method call.
annotation
)

Creates a stack manipulation which loads a super-call proxy onto the stack.

public static Super.Instantiation
public static Super.Instantiation[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CONSTRUCTORback to summary
public static final Super.Instantiation CONSTRUCTOR

A proxy instance is instantiated by its constructor. For the constructor's arguments, the parameters default values are used. The constructor can be identified by setting Super#constructorParameters().

CONSTRUCTOR_PARAMETERSback to summary
private static final MethodDescription.InDefinedShape CONSTRUCTOR_PARAMETERS

A reference to the constructor parameters method.

IGNORE_FINALIZERback to summary
private static final MethodDescription.InDefinedShape IGNORE_FINALIZER

A reference to the ignore finalizer method.

SERIALIZABLE_PROXYback to summary
private static final MethodDescription.InDefinedShape SERIALIZABLE_PROXY

A reference to the serializable proxy method.

UNSAFEback to summary
public static final Super.Instantiation UNSAFE

A proxy is instantiated by calling JVM internal methods and without calling a constructor. This strategy might fail on exotic JVM implementations.

Constructor Detail

Instantiationback to summary
private Instantiation()

Method Detail

proxyForback to summary
protected abstract StackManipulation proxyFor(TypeDescription parameterType, Implementation.Target implementationTarget, AnnotationDescription.Loadable<Super> annotation)

Creates a stack manipulation which loads a super-call proxy onto the stack.

Parameters
parameterType:TypeDescription

The type of the parameter that was annotated with net.bytebuddy.implementation.bind.annotation.Super

implementationTarget:Implementation.Target

The implementation target for the currently created type.

annotation:AnnotationDescription.Loadable<Super>

The annotation that caused this method call.

Returns:StackManipulation

A stack manipulation representing this instance's instantiation strategy.

valueOfback to summary
public static Super.Instantiation valueOf(String name)
valuesback to summary
public static Super.Instantiation[] values()