public abstract class FieldAccessor extends Object implements Implementation
Defines a method to access a given field by following the Java bean conventions for getters and setters:
getFoo() will be instrumented to read and return the value of a field foo
 or another field if one was specified explicitly. If a property is of type Boolean or
 boolean, the name isFoo() is also permitted.setFoo(value) will be instrumented to write the given argument value
 to a field foo or to another field if one was specified explicitly.
 Field accessors always implement a getter if a non-void value is returned from a method and attempt to define a setter
 otherwise. If a field accessor is not explicitly defined as a setter via FieldAccessor.PropertyConfigurable, an instrumented
 method must define exactly one parameter. Using the latter API, an explicit parameter index can be defined and a return
 value can be specified explicitly when void is not returned.
 
| Type | Property and Description | 
|---|---|
static FieldAccessor.OwnerTypeLocatable | 
ofBean
Defines a field accessor where any access is targeted to a field that matches the methods
 name with the Java specification for bean properties, i.e. a method  
getFoo or setFoo(value)
 will either read or write a field named foo. | 
| Modifier and Type | Class and Description | 
|---|---|
static interface  | 
FieldAccessor.AssignerConfigurable
A field accessor that can be configured to use a given assigner and runtime type use configuration. 
 | 
protected static interface  | 
FieldAccessor.FieldLocation
A field location represents an identified field description which depends on the instrumented type and method. 
 | 
static interface  | 
FieldAccessor.FieldNameExtractor
A field name extractor is responsible for determining a field name to a method that is implemented
 to access this method. 
 | 
protected static class  | 
FieldAccessor.ForImplicitProperty
A field accessor for an implicit property where a getter or setter property is infered from the signature. 
 | 
protected static class  | 
FieldAccessor.ForParameterSetter
A field accessor that sets a parameters value of a given index. 
 | 
static interface  | 
FieldAccessor.OwnerTypeLocatable
A field accessor that can be configured to locate a field in a specific manner. 
 | 
static interface  | 
FieldAccessor.PropertyConfigurable
A field accessor that allows to define the access to be a field write of a given argument. 
 | 
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target| Modifier and Type | Field and Description | 
|---|---|
protected Assigner | 
assigner
The assigner to use. 
 | 
protected FieldAccessor.FieldLocation | 
fieldLocation
The field's location. 
 | 
protected Assigner.Typing | 
typing
Indicates if dynamic type castings should be attempted for incompatible assignments. 
 | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
FieldAccessor(FieldAccessor.FieldLocation fieldLocation,
             Assigner assigner,
             Assigner.Typing typing)
Creates a new field accessor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected StackManipulation | 
getter(FieldDescription fieldDescription,
      MethodDescription instrumentedMethod)
Creates a getter getter. 
 | 
static FieldAccessor.AssignerConfigurable | 
of(Field field)
Defines a field accessor where the specified field is accessed. 
 | 
static FieldAccessor.OwnerTypeLocatable | 
of(FieldAccessor.FieldNameExtractor fieldNameExtractor)
Defines a custom strategy for determining the field that is accessed by this field accessor. 
 | 
static FieldAccessor.AssignerConfigurable | 
of(FieldDescription fieldDescription)
Defines a field accessor where the specified field is accessed. 
 | 
static FieldAccessor.OwnerTypeLocatable | 
ofBeanProperty()
Defines a field accessor where any access is targeted to a field that matches the methods
 name with the Java specification for bean properties, i.e. a method  
getFoo or setFoo(value)
 will either read or write a field named foo. | 
static FieldAccessor.OwnerTypeLocatable | 
ofField(String name)
Defines a field accessor where any access is targeted to a field named  
name. | 
InstrumentedType | 
prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type. 
 | 
protected StackManipulation | 
setter(FieldDescription fieldDescription,
      ParameterDescription parameterDescription)
Creates a setter instruction. 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappenderpublic static FieldAccessor.OwnerTypeLocatable ofBeanProperty
getFoo or setFoo(value)
 will either read or write a field named foo.protected final FieldAccessor.FieldLocation fieldLocation
protected final Assigner assigner
protected final Assigner.Typing typing
protected FieldAccessor(FieldAccessor.FieldLocation fieldLocation, Assigner assigner, Assigner.Typing typing)
fieldLocation - The field's location.assigner - The assigner to use.typing - Indicates if dynamic type castings should be attempted for incompatible assignments.public static FieldAccessor.OwnerTypeLocatable ofField(String name)
name.name - The name of the field to be accessed.public static FieldAccessor.OwnerTypeLocatable ofBeanProperty()
getFoo or setFoo(value)
 will either read or write a field named foo.public static FieldAccessor.OwnerTypeLocatable of(FieldAccessor.FieldNameExtractor fieldNameExtractor)
fieldNameExtractor - The field name extractor to use.public static FieldAccessor.AssignerConfigurable of(Field field)
field - The field being accessed.public static FieldAccessor.AssignerConfigurable of(FieldDescription fieldDescription)
fieldDescription - The field being accessed.protected StackManipulation getter(FieldDescription fieldDescription, MethodDescription instrumentedMethod)
fieldDescription - The field to read the value from.instrumentedMethod - The getter method.protected StackManipulation setter(FieldDescription fieldDescription, ParameterDescription parameterDescription)
fieldDescription - The field to set a value for.parameterDescription - The parameter for what value is to be set.public InstrumentedType prepare(InstrumentedType instrumentedType)
InstrumentedType.Prepareableprepare in interface InstrumentedType.PrepareableinstrumentedType - The instrumented type in its current form.Copyright © 2014–2017. All rights reserved.