Interface ModifiableFieldReference

All Superinterfaces:
FieldInfo, MemberInfo

public interface ModifiableFieldReference extends FieldInfo
  • Method Details

    • method

      MethodInfo method()
    • field

      FieldInfo field()
    • 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.