Class Morph.Binder
- java.lang.Object
-
- net.bytebuddy.implementation.bind.annotation.Morph.Binder
-
- All Implemented Interfaces:
TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph>
- Enclosing class:
- Morph
@Enhance public static class Morph.Binder extends java.lang.Object implements TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph>
A binder for theMorph
annotation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
Morph.Binder.DefaultMethodLocator
A default method locator is responsible for looking up a default method to a given source method.protected static class
Morph.Binder.RedirectionProxy
A proxy that implements the installed interface in order to allow for a morphed super method invocation.-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<S extends java.lang.annotation.Annotation>, TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<S extends java.lang.annotation.Annotation>
-
-
Field Summary
Fields Modifier and Type Field Description private static MethodDescription.InDefinedShape
DEFAULT_METHOD
A reference to the default method method.private static MethodDescription.InDefinedShape
DEFAULT_TARGET
A reference to the default target method.private MethodDescription
forwardingMethod
The method which is overridden for generating the proxy class.private static MethodDescription.InDefinedShape
SERIALIZABLE_PROXY
A reference to the serializable proxy method.-
Fields inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
DEFAULTS
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Binder(MethodDescription forwardingMethod)
Creates a new binder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodDelegationBinder.ParameterBinding<?>
bind(AnnotationDescription.Loadable<Morph> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner, Assigner.Typing typing)
Creates a parameter binding for the given target parameter.java.lang.Class<Morph>
getHandledType()
The annotation type that is handled by this parameter binder.static TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph>
install(java.lang.Class<?> type)
Installs a given type for use on aMorph
annotation.static TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph>
install(TypeDescription typeDescription)
Installs a given type for use on aMorph
annotation.private static MethodDescription
onlyMethod(TypeDescription typeDescription)
Extracts the only method of a given type and validates to fit the constraints of the morph annotation.
-
-
-
Field Detail
-
SERIALIZABLE_PROXY
private static final MethodDescription.InDefinedShape SERIALIZABLE_PROXY
A reference to the serializable proxy method.
-
DEFAULT_METHOD
private static final MethodDescription.InDefinedShape DEFAULT_METHOD
A reference to the default method method.
-
DEFAULT_TARGET
private static final MethodDescription.InDefinedShape DEFAULT_TARGET
A reference to the default target method.
-
forwardingMethod
private final MethodDescription forwardingMethod
The method which is overridden for generating the proxy class.
-
-
Constructor Detail
-
Binder
protected Binder(MethodDescription forwardingMethod)
Creates a new binder.- Parameters:
forwardingMethod
- The method which is overridden for generating the proxy class.
-
-
Method Detail
-
install
public static TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph> install(java.lang.Class<?> type)
Installs a given type for use on aMorph
annotation. The given type must be an interface without any super interfaces and a single method which maps anObject
array to aObject
type. The use of generics is permitted.- Parameters:
type
- The type to install.- Returns:
- A binder for the
Morph
annotation.
-
install
public static TargetMethodAnnotationDrivenBinder.ParameterBinder<Morph> install(TypeDescription typeDescription)
Installs a given type for use on aMorph
annotation. The given type must be an interface without any super interfaces and a single method which maps anObject
array to aObject
type. The use of generics is permitted.- Parameters:
typeDescription
- The type to install.- Returns:
- A binder for the
Morph
annotation.
-
onlyMethod
private static MethodDescription onlyMethod(TypeDescription typeDescription)
Extracts the only method of a given type and validates to fit the constraints of the morph annotation.- Parameters:
typeDescription
- The type to extract the method from.- Returns:
- The only method after validation.
-
getHandledType
public java.lang.Class<Morph> getHandledType()
The annotation type that is handled by this parameter binder.- Specified by:
getHandledType
in interfaceTargetMethodAnnotationDrivenBinder.ParameterBinder<Morph>
- Returns:
- The
Annotation.annotationType()
handled by this parameter binder.
-
bind
public MethodDelegationBinder.ParameterBinding<?> bind(AnnotationDescription.Loadable<Morph> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner, Assigner.Typing typing)
Creates a parameter binding for the given target parameter.- Specified by:
bind
in interfaceTargetMethodAnnotationDrivenBinder.ParameterBinder<Morph>
- Parameters:
annotation
- The annotation that was cause for the delegation to this argument binder.source
- The intercepted source method.target
- Tge target parameter that is subject to be bound to intercepting thesource
method.implementationTarget
- The target of the current implementation that is subject to this binding.assigner
- An assigner that can be used for applying the binding.typing
- The typing to apply.- Returns:
- A parameter binding for the requested target method parameter.
-
-