org.glassfish.pfl.dynamic.codegen.spi
Interface ModifiableFieldReference

All Superinterfaces:
FieldInfo, MemberInfo

public interface ModifiableFieldReference
extends FieldInfo


Nested Class Summary
static class ModifiableFieldReference.ReferenceType
           
 
Method Summary
 void complete()
          Mark the end of the code generation to replace the field reference.
 FieldInfo field()
           
 ModifiableFieldReference.ReferenceType getReferenceType()
           
 Variable getTargetObject()
          Return an expression that can be used to access the target object, if !Modifier.isStatic(field().modifiers()).
 Variable getValue()
          Return an expression that can be used to access the field value.
 MethodInfo method()
           
 void replace()
          After this call, the field reference will not be emitted.
 
Methods inherited from interface org.glassfish.pfl.dynamic.codegen.spi.FieldInfo
type
 
Methods inherited from interface org.glassfish.pfl.dynamic.codegen.spi.MemberInfo
isAccessibleInContext, modifiers, myClassInfo, name
 

Method Detail

method

MethodInfo method()

field

FieldInfo field()

getReferenceType

ModifiableFieldReference.ReferenceType getReferenceType()

getTargetObject

Variable getTargetObject()
Return an expression that can be used to access the target object, if !Modifier.isStatic(field().modifiers()). This variable refers to the target object available before the set or get of the field. If the field is static, this returns null.


getValue

Variable getValue()
Return an expression that can be used to access the field value. If getReferenceType()==GET, this variable must be set to the value returned by the reference. If getReferenceType()==SET, this variable contains the value to be stored by the reference.


replace

void replace()
After this call, the field reference will not be emitted. Instead, any sequence of Wrapper calls valid in a method body may be used to generate replacement code for the field reference. As an example, the following code would cause equivalent code to the original reference to be emitted, in the case of a non-static field:
 Variable target = mf.getTargetObject() ;
 Variable value = mf.getValue() ;
 String name = field().name() ;

 // For getReferenceType() == GET:
 _assign( value, _field( target, name ) ) ;

 // For getRerenceType() == SET:
 _assign( _field( target, name ), value ) ;

 


complete

void complete()
Mark the end of the code generation to replace the field reference.



Copyright © 2013 Oracle. All Rights Reserved.