Class FieldProxy.Binder
java.lang.Object
net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<FieldProxy>
net.bytebuddy.implementation.bind.annotation.FieldProxy.Binder
- All Implemented Interfaces:
TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy>
- Enclosing class:
FieldProxy
@Enhance
public static class FieldProxy.Binder
extends TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<FieldProxy>
A binder for the
FieldProxy annotation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classA proxy type for accessing a field either by a getter or a setter.protected static classImplementation for a getter method.protected static interfaceA resolver for creating an instrumentation for a field access.protected static classImplementation for a setter method.protected static classRepresents an implementation for implementing a proxy type constructor when a non-static field is accessed.protected static enumRepresents an implementation for implementing a proxy type constructor when a static field is accessed.Nested classes/interfaces inherited from interface TargetMethodAnnotationDrivenBinder.ParameterBinder
TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<S>, TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFixedValue<S> -
Field Summary
Fields inherited from class TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding
BEAN_PROPERTYFields inherited from interface TargetMethodAnnotationDrivenBinder.ParameterBinder
DEFAULTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBinder(MethodDescription.InDefinedShape getterMethod, MethodDescription.InDefinedShape setterMethod) Creates a new binder for aFieldProxyin simplex mode.protectedBinder(TypeDescription proxyType, MethodDescription.InDefinedShape getterMethod, MethodDescription.InDefinedShape setterMethod) Creates a new binder for aFieldProxyin duplex mode.protectedBinder(FieldProxy.Binder.FieldResolver.Factory fieldResolverFactory) Creates a new binder for aFieldProxy. -
Method Summary
Modifier and TypeMethodDescriptionprotected MethodDelegationBinder.ParameterBinding<?> bind(FieldDescription fieldDescription, AnnotationDescription.Loadable<FieldProxy> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner) Creates a parameter binding for the given target parameter.protected TypeDescriptiondeclaringType(AnnotationDescription.Loadable<FieldProxy> annotation) Extracts the declaring type from an annotation.protected StringfieldName(AnnotationDescription.Loadable<FieldProxy> annotation) Extracts the field name from an annotation.The annotation type that is handled by this parameter binder.Creates a binder by installing a single proxy type where annotating a parameter withFieldProxyallows getting and setting values for a given field.Creates a binder by installing two proxy types which are implemented by this binder if a field getter or a field setter is requested by using theFieldProxyannotation.install(TypeDescription typeDescription) Creates a binder by installing a single proxy type where annotating a parameter withFieldProxyallows getting and setting values for a given field.install(TypeDescription getterType, TypeDescription setterType) Creates a binder by installing two proxy types which are implemented by this binder if a field getter or a field setter is requested by using theFieldProxyannotation.Methods inherited from class TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding
bind
-
Constructor Details
-
Binder
protected Binder(MethodDescription.InDefinedShape getterMethod, MethodDescription.InDefinedShape setterMethod) Creates a new binder for aFieldProxyin simplex mode.- Parameters:
getterMethod- The getter method.setterMethod- The setter method.
-
Binder
protected Binder(TypeDescription proxyType, MethodDescription.InDefinedShape getterMethod, MethodDescription.InDefinedShape setterMethod) Creates a new binder for aFieldProxyin duplex mode.- Parameters:
proxyType- The proxy type.getterMethod- The getter method.setterMethod- The setter method.
-
Binder
Creates a new binder for aFieldProxy.- Parameters:
fieldResolverFactory- The field resolver factory to apply by this binder.
-
-
Method Details
-
install
Creates a binder by installing a single proxy type where annotating a parameter withFieldProxyallows getting and setting values for a given field.- Parameters:
type- A type which declares exactly one abstract getter and an abstract setter for theObjecttype. The type is allowed to be generic.- Returns:
- A binder for the
FieldProxyannotation.
-
install
public static TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy> install(TypeDescription typeDescription) Creates a binder by installing a single proxy type where annotating a parameter withFieldProxyallows getting and setting values for a given field.- Parameters:
typeDescription- A type which declares exactly one abstract getter and an abstract setter for theObjecttype. The type is allowed to be generic.- Returns:
- A binder for the
FieldProxyannotation.
-
install
public static TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy> install(Class<?> getterType, Class<?> setterType) Creates a binder by installing two proxy types which are implemented by this binder if a field getter or a field setter is requested by using theFieldProxyannotation.- Parameters:
getterType- The type which should be used for getter proxies. The type must represent an interface which defines a single method which returns anObjectreturn type and does not take any arguments. The use of generics is permitted.setterType- The type which should be uses for setter proxies. The type must represent an interface which defines a single method which returnsvoidand takes a singleObject-typed argument. The use of generics is permitted.- Returns:
- A binder for the
FieldProxyannotation.
-
install
public static TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy> install(TypeDescription getterType, TypeDescription setterType) Creates a binder by installing two proxy types which are implemented by this binder if a field getter or a field setter is requested by using theFieldProxyannotation.- Parameters:
getterType- The type which should be used for getter proxies. The type must represent an interface which defines a single method which returns anObjectreturn type and does not take any arguments. The use of generics is permitted.setterType- The type which should be uses for setter proxies. The type must represent an interface which defines a single method which returnsvoidand takes a singleObject-typed argument. The use of generics is permitted.- Returns:
- A binder for the
FieldProxyannotation.
-
getHandledType
The annotation type that is handled by this parameter binder.- Returns:
- The
Annotation.annotationType()handled by this parameter binder.
-
fieldName
Description copied from class:TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBindingExtracts the field name from an annotation.- Specified by:
fieldNamein classTargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<FieldProxy>- Parameters:
annotation- The annotation from which to extract the field name.- Returns:
- The field name defined by the handled annotation.
-
declaringType
Description copied from class:TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBindingExtracts the declaring type from an annotation.- Specified by:
declaringTypein classTargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<FieldProxy>- Parameters:
annotation- The annotation from which to extract the declaring type.- Returns:
- The declaring type defined by the handled annotation.
-
bind
protected MethodDelegationBinder.ParameterBinding<?> bind(FieldDescription fieldDescription, AnnotationDescription.Loadable<FieldProxy> annotation, MethodDescription source, ParameterDescription target, Implementation.Target implementationTarget, Assigner assigner) Description copied from class:TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBindingCreates a parameter binding for the given target parameter.- Specified by:
bindin classTargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding<FieldProxy>- Parameters:
fieldDescription- The field for which this binder binds a value.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 thesourcemethod.implementationTarget- The target of the current implementation that is subject to this binding.assigner- An assigner that can be used for applying the binding.- Returns:
- A parameter binding for the requested target method parameter.
-