public interface PlasticField extends AnnotationAccess
Modifier and Type | Method and Description |
---|---|
PlasticField |
claim(Object tag)
Claims the field, used to indicate that the field is "processed".
|
PlasticField |
createAccessors(PropertyAccessType accessType)
Creates access to the field, using the default property name derived from the name of the field.
|
PlasticField |
createAccessors(PropertyAccessType accessType,
String propertyName)
Creates accessors, possibly replacing existing methods (or overriding methods from a super class).
|
String |
getGenericSignature()
Returns the field's fully qualified generic type, or null if not defined.
|
FieldHandle |
getHandle()
Returns a handle that can be used to directly access a private field of a
transformed class instance.
|
int |
getModifiers()
Returns the modifiers on the field.
|
String |
getName()
Returns the name of the field.
|
PlasticClass |
getPlasticClass()
Returns the class containing this field.
|
String |
getTypeName()
Returns the fully qualified class name for the field's type or (for a primitive type)
the primitive type name ("int", "char", etc.).
|
PlasticField |
inject(Object value)
Converts the field to be read-only, and provide the indicated value.
|
PlasticField |
injectComputed(ComputedValue<?> computedValue)
Converts the field to be read-only, and provide the value, which is computed
indirectly inside the class' constructor.
|
PlasticField |
injectFromInstanceContext()
As with
inject(Object) , but the value is extracted from the InstanceContext . |
boolean |
isClaimed()
Returns true if the field has already been claimed.
|
<F> PlasticField |
setComputedConduit(ComputedValue<FieldConduit<F>> computedConduit)
Sets the conduit for the field to a value computed when the class is instantiated
|
<F> PlasticField |
setConduit(FieldConduit<F> conduit)
Intercepts all access to the field, replacing such access with calls on the conduit.
|
getAnnotation, hasAnnotation
PlasticClass getPlasticClass()
FieldHandle getHandle()
String getTypeName()
PlasticField claim(Object tag)
PlasticClassTransformer
that performed the transformation. That tag value is only used when generating the error message for the case
where a field is claimed for than once.RuntimeException
- if the field is claimed a second timeAssertionError
- if tag is nullPlasticClass.getUnclaimedFields()
boolean isClaimed()
PlasticClass.getUnclaimedFields()
PlasticField inject(Object value)
value
- to inject, which must be type compatible with the field (possibly, a wrapper type if the field is
a primitive value). The value may not be null.IllegalStateException
- if the field already has an injection, or the field has a conduitPlasticField injectComputed(ComputedValue<?> computedValue)
computedValue
- provides the actual value to be injected, and must return a value type compatible
with the field (possibly a wrapper type if the field is a primitive value). The computedValue may not
be null.IllegalStateException
- if the field already has an injection, or the field has a conduitPlasticField injectFromInstanceContext()
inject(Object)
, but the value is extracted from the InstanceContext
.<F> PlasticField setConduit(FieldConduit<F> conduit)
TransformationOption.FIELD_WRITEBEHIND
is useful when operating in a non-production mode.IllegalStateException
- if the field already has an injection or a conduit<F> PlasticField setComputedConduit(ComputedValue<FieldConduit<F>> computedConduit)
computedConduit
- object that will compute the actual conduit to be usedPlasticField createAccessors(PropertyAccessType accessType)
accessType
- which methods to createIllegalArgumentException
- if an accessor method to be created already exists (possibly inherited from a base class)PlasticField createAccessors(PropertyAccessType accessType, String propertyName)
accessType
- which methods to createpropertyName
- the name of the property (from which the names of the methods are generated)IllegalArgumentException
- if an accessor method to be created already exists (possibly inherited from a base class)String getGenericSignature()
int getModifiers()
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.