public interface PlasticField extends AnnotationAccess
Modifier and Type | Method and Description |
---|---|
PlasticField |
claim(java.lang.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,
java.lang.String propertyName)
Creates accessors, possibly replacing existing methods (or overriding methods from a super class).
|
java.lang.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.
|
java.lang.String |
getName()
Returns the name of the field.
|
PlasticClass |
getPlasticClass()
Returns the class containing this field.
|
java.lang.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(java.lang.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()
java.lang.String getName()
java.lang.String getTypeName()
PlasticField claim(java.lang.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.java.lang.RuntimeException
- if the field is claimed a second timejava.lang.AssertionError
- if tag is nullPlasticClass.getUnclaimedFields()
boolean isClaimed()
PlasticClass.getUnclaimedFields()
PlasticField inject(java.lang.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.java.lang.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.java.lang.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.java.lang.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 createjava.lang.IllegalArgumentException
- if an accessor method to be created already exists (possibly inherited from a base class)PlasticField createAccessors(PropertyAccessType accessType, java.lang.String propertyName)
accessType
- which methods to createpropertyName
- the name of the property (from which the names of the methods are generated)java.lang.IllegalArgumentException
- if an accessor method to be created already exists (possibly inherited from a base class)java.lang.String getGenericSignature()
int getModifiers()
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.