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 theFieldProxyannotation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFieldProxy.Binder.AccessorProxyA proxy type for accessing a field either by a getter or a setter.protected static classFieldProxy.Binder.FieldGetterImplementation for a getter method.protected static interfaceFieldProxy.Binder.FieldResolverA resolver for creating an instrumentation for a field access.protected static classFieldProxy.Binder.FieldSetterImplementation for a setter method.protected static classFieldProxy.Binder.InstanceFieldConstructorRepresents an implementation for implementing a proxy type constructor when a non-static field is accessed.protected static classFieldProxy.Binder.StaticFieldConstructorRepresents an implementation for implementing a proxy type constructor when a static field is accessed.-
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.InDefinedShapeDECLARING_TYPEA reference to the method that declares the field annotation's defining type property.private static MethodDescription.InDefinedShapeFIELD_NAMEA reference to the method that declares the field annotation's field name property.private FieldProxy.Binder.FieldResolver.FactoryfieldResolverFactoryThe field resolver factory to apply by this binder.private static MethodDescription.InDefinedShapeSERIALIZABLE_PROXYA reference to the method that declares the field annotation's serializable proxy property.-
Fields inherited from class net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding
BEAN_PROPERTY
-
Fields inherited from interface net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder
DEFAULTS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBinder(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 java.lang.StringfieldName(AnnotationDescription.Loadable<FieldProxy> annotation)Extracts the field name from an annotation.java.lang.Class<FieldProxy>getHandledType()The annotation type that is handled by this parameter binder.static TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy>install(java.lang.Class<?> type)Creates a binder by installing a single proxy type where annotating a parameter withFieldProxyallows getting and setting values for a given field.static TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy>install(java.lang.Class<?> getterType, java.lang.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.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.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.private static MethodDescription.InDefinedShapeonlyMethod(TypeDescription typeDescription)Extracts the only method from a given type description which is validated for the required properties for using the type as a proxy base type.-
Methods inherited from class net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder.ForFieldBinding
bind
-
-
-
-
Field Detail
-
DECLARING_TYPE
private static final MethodDescription.InDefinedShape DECLARING_TYPE
A reference to the method that declares the field annotation's defining type property.
-
FIELD_NAME
private static final MethodDescription.InDefinedShape FIELD_NAME
A reference to the method that declares the field annotation's field name property.
-
SERIALIZABLE_PROXY
private static final MethodDescription.InDefinedShape SERIALIZABLE_PROXY
A reference to the method that declares the field annotation's serializable proxy property.
-
fieldResolverFactory
private final FieldProxy.Binder.FieldResolver.Factory fieldResolverFactory
The field resolver factory to apply by this binder.
-
-
Constructor Detail
-
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
protected Binder(FieldProxy.Binder.FieldResolver.Factory fieldResolverFactory)
Creates a new binder for aFieldProxy.- Parameters:
fieldResolverFactory- The field resolver factory to apply by this binder.
-
-
Method Detail
-
install
public static TargetMethodAnnotationDrivenBinder.ParameterBinder<FieldProxy> install(java.lang.Class<?> type)
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(java.lang.Class<?> getterType, java.lang.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.
-
onlyMethod
private static MethodDescription.InDefinedShape onlyMethod(TypeDescription typeDescription)
Extracts the only method from a given type description which is validated for the required properties for using the type as a proxy base type.- Parameters:
typeDescription- The type description to evaluate.- Returns:
- The only method which was found to be compatible to the proxy requirements.
-
getHandledType
public java.lang.Class<FieldProxy> getHandledType()
The annotation type that is handled by this parameter binder.- Returns:
- The
Annotation.annotationType()handled by this parameter binder.
-
fieldName
protected java.lang.String fieldName(AnnotationDescription.Loadable<FieldProxy> annotation)
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
protected TypeDescription declaringType(AnnotationDescription.Loadable<FieldProxy> annotation)
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.
-
-