Interface FieldAccessor.PropertyConfigurable
-
- All Superinterfaces:
Implementation
,InstrumentedType.Prepareable
- All Known Subinterfaces:
FieldAccessor.AssignerConfigurable
,FieldAccessor.OwnerTypeLocatable
- All Known Implementing Classes:
FieldAccessor.ForImplicitProperty
- Enclosing class:
- FieldAccessor
public static interface FieldAccessor.PropertyConfigurable extends Implementation
A field accessor that allows to define the access to be a field write of a given argument.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Implementation.Composable
setsArgumentAt(int index)
Defines a setter of the specified parameter for the field being described.Implementation.Composable
setsDefaultValue()
Defines a setter of the described field's default value, i.e.Implementation.Composable
setsFieldValueOf(java.lang.reflect.Field field)
Defines a setter of a value that sets another field's value.Implementation.Composable
setsFieldValueOf(java.lang.String fieldName)
Defines a setter of a value that sets another field's value.Implementation.Composable
setsFieldValueOf(FieldDescription fieldDescription)
Defines a setter of a value that sets another field's value.Implementation.Composable
setsFieldValueOf(FieldAccessor.FieldNameExtractor fieldNameExtractor)
Defines a setter of a value that sets another field's value.Implementation.Composable
setsReference(java.lang.Object value)
Defines a setter of a given value for the described field.Implementation.Composable
setsReference(java.lang.Object value, java.lang.String name)
Defines a setter of a given value for the described field.Implementation.Composable
setsValue(java.lang.Object value)
Defines a setter of a given value for the described field.Implementation.Composable
setsValue(TypeDescription typeDescription)
Defines a setter of a given class constant value for the described field.Implementation.Composable
setsValue(StackManipulation stackManipulation, java.lang.reflect.Type type)
Defines a setter of a value that is represented by a stack manipulation.Implementation.Composable
setsValue(StackManipulation stackManipulation, TypeDescription.Generic typeDescription)
Defines a setter of a value that is represented by a stack manipulation.Implementation.Composable
setsValue(JavaConstant constant)
Defines a setter of a given constant value for the described field.-
Methods inherited from interface net.bytebuddy.implementation.Implementation
appender
-
Methods inherited from interface net.bytebuddy.dynamic.scaffold.InstrumentedType.Prepareable
prepare
-
-
-
-
Method Detail
-
setsArgumentAt
Implementation.Composable setsArgumentAt(int index)
Defines a setter of the specified parameter for the field being described.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
index
- The index of the parameter for which to set the field's value.- Returns:
- An instrumentation that sets the parameter's value to the described field.
-
setsDefaultValue
Implementation.Composable setsDefaultValue()
Defines a setter of the described field's default value, i.e.
null
or a primitive type's representation of0
.Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Returns:
- An instrumentation that sets the field's default value.
-
setsValue
Implementation.Composable setsValue(java.lang.Object value)
Defines a setter of a given value for the described field. If the value is a constant value, it will be defined as a constant assignment, otherwise it is defined as a reference value that is stored in a static field of the instrumented type.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
value
- The value to set.- Returns:
- An instrumentation that sets the field's value as specified.
-
setsValue
Implementation.Composable setsValue(TypeDescription typeDescription)
Defines a setter of a given class constant value for the described field.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
typeDescription
- The type to set to the described field.- Returns:
- An instrumentation that sets the field's value to the given class constant.
-
setsValue
Implementation.Composable setsValue(JavaConstant constant)
Defines a setter of a given constant value for the described field.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
constant
- The constant to set as a value.- Returns:
- An instrumentation that sets the field's value to the given constant.
-
setsValue
Implementation.Composable setsValue(StackManipulation stackManipulation, java.lang.reflect.Type type)
Defines a setter of a value that is represented by a stack manipulation.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
stackManipulation
- A stack manipulation to load the field's value.type
- The field value's type.- Returns:
- An instrumentation that sets the field's value to the given value.
-
setsValue
Implementation.Composable setsValue(StackManipulation stackManipulation, TypeDescription.Generic typeDescription)
Defines a setter of a value that is represented by a stack manipulation.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
stackManipulation
- A stack manipulation to load the field's value.typeDescription
- The field value's type.- Returns:
- An instrumentation that sets the field's value to the given value.
-
setsReference
Implementation.Composable setsReference(java.lang.Object value)
Defines a setter of a given value for the described field. The value is kept as a referenced that is stored in a static field of the instrumented type. The field name is chosen based on the value's hash code.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
value
- The value to set.- Returns:
- An instrumentation that sets the field's value as specified.
-
setsReference
Implementation.Composable setsReference(java.lang.Object value, java.lang.String name)
Defines a setter of a given value for the described field. The value is kept as a referenced that is stored in a static field of the instrumented type.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
value
- The value to set.name
- The name of the field.- Returns:
- An instrumentation that sets the field's value as specified.
-
setsFieldValueOf
Implementation.Composable setsFieldValueOf(java.lang.reflect.Field field)
Defines a setter of a value that sets another field's value.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
field
- The field that holds the value to be set.- Returns:
- An instrumentation that sets the field's value to the specified field's value.
-
setsFieldValueOf
Implementation.Composable setsFieldValueOf(FieldDescription fieldDescription)
Defines a setter of a value that sets another field's value.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
fieldDescription
- The field that holds the value to be set.- Returns:
- An instrumentation that sets the field's value to the specified field's value.
-
setsFieldValueOf
Implementation.Composable setsFieldValueOf(java.lang.String fieldName)
Defines a setter of a value that sets another field's value.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
fieldName
- The name of the field that is specified by the instrumented type.- Returns:
- An instrumentation that sets the field's value to the specified field's value.
-
setsFieldValueOf
Implementation.Composable setsFieldValueOf(FieldAccessor.FieldNameExtractor fieldNameExtractor)
Defines a setter of a value that sets another field's value.
Note: If the instrumented method does not return
void
, a chained instrumentation must be supplied.- Parameters:
fieldNameExtractor
- A field name extractor for the field that is specified by the instrumented type.- Returns:
- An instrumentation that sets the field's value to the specified field's value.
-
-