system/src/sc/lang/java/IdentifierExpression.java
public static void makeBindable(Statement expr, String propertyName, IdentifierType idType, Object boundType,
                                   Object typeForIdentifier, Object referenceType, boolean referenceOnly, boolean checkAnnotations) {

      // Once we've been transformed, no need to add these dependencies
      if (boundType == null || typeForIdentifier == null || expr.getTransformed())
         return;

      // A lot of times the boundType is in some super-type of an annotated type in the system so we need
      // to get the most specific reference before we start looking for annotations.
      // No longer necessary because we do the resolve for assignments anyway?
      //Object annotType = ModelUtil.resolveAnnotationReference(expr.getJavaModel(), boundType);
      Object annotType = boundType;
      if (boundType instanceof PropertyAssignment)
         boundType = ((PropertyAssignment) boundType).getAssignedProperty();
      if (idType == IdentifierType.FieldName || idType == IdentifierType.GetSetMethodInvocation) {
         if (!ModelUtil.isConstant(annotType)) {
            if (boundType instanceof ParamTypedMember)
               boundType = ((ParamTypedMember) boundType).getMemberObject();
            if (boundType instanceof VariableDefinition) {
               VariableDefinition varDef = (VariableDefinition) boundType;
               varDef.makeBindable(referenceOnly);
               JavaModel fromModel = expr.getJavaModel();
               if (fromModel != null) {
                  if (referenceType instanceof TypeDeclaration) {
                     TypeDeclaration toType = varDef.getEnclosingType();
                     JavaModel toModel = toType.getJavaModel();
                     if (toModel != null)
                        toModel.addBindDependency(toType, propertyName, fromModel.getModelTypeDeclaration(), referenceOnly);
                  }
                  else if (referenceType != null)
                     System.err.println("*** Compiled type used to inject binding dependency?");
               }
            }
            else if (boundType instanceof Field) {
               // TODO: need to add logic to make a compiled field bindable in a subclass, more like below
               System.out.println("*** Warning; binding expression involving non-bindable field: " +
                       boundType + " in expression: " + expr.toDefinitionString());
            }
            else if (boundType instanceof IBeanMapper)
               checkForBindableCompiledField(propertyName, boundType, annotType, referenceType, expr, referenceOnly, checkAnnotations);
         }
      }
      else if (isGetOrIs(idType) && ModelUtil.getBindableAnnotation(annotType) == null && !ModelUtil.isConstant(annotType)) {
         TypeDeclaration referenceTD;

         // If we have a method, it means we can inject bindability by renaming the old method
         if (boundType instanceof IMethodDefinition) {
            IMethodDefinition getMethod = ((IMethodDefinition) boundType);
            Object encType = getMethod.getDeclaringType();
            if (encType instanceof TypeDeclaration) {
               String getName = ModelUtil.getMethodName(getMethod);
               referenceTD = (TypeDeclaration) encType;
               String setName = "set" + (getName.startsWith("is") ? getName.substring(2) : getName.substring(3));
               Object setMethod = referenceTD.definesMethod(setName, Collections.singletonList(typeForIdentifier), null, null, referenceTD.isTransformedType(), false, null, null);
               if (setMethod != null) {
                  // Do dynamic access only if the property is marked as manually bindable.
                  referenceTD.addPropertyToMakeBindable(propertyName, boundType, expr.getJavaModel(), referenceOnly || ModelUtil.isManualBindable(setMethod), expr);
               }
            }
            else if (encType instanceof ITypeDeclaration) {
               checkForBindableCompiledField(propertyName, boundType, annotType, referenceType, expr, referenceOnly, checkAnnotations);
            }
            else
               System.err.println("*** Can't make non-class types bindable " + encType + " for: " + propertyName);

            // TODO: else read-only property?  Or in this case, do we need to check the MemberOwner again?
         }
         else if (boundType instanceof IBeanMapper) {
            checkForBindableCompiledField(propertyName, boundType, annotType, referenceType, expr, referenceOnly, checkAnnotations);
         }
      }
      else if (idType == IdentifierExpression.IdentifierType.MethodInvocation) {
         checkForDynMethod(boundType, referenceType, (Expression) expr);
      }
      else if (idType == IdentifierType.BoundObjectName) {
         if (boundType instanceof BodyTypeDeclaration)
            ModelUtil.markNeedsDynAccess(boundType);
         // We can have an object which is in compiled form, not anything we need to do
      }
   }
/**
    * Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the
    * referenced object.   When referenceOnly = true, this is a getX reference only - not requiring that the referred
    * property be made bindable.  This method both ensures the property is registered with it's parent type and
    * adds a reference to that type in ReverseDependencies - reflecting the dependency from the type which needs
    * this property bindable.  When checkAnnotations is true, referenceOnly starts out false but then turns to 'true' if
    * this property is marked as @Bindable so that we inject it during the code-gen phase (i.e. not manual bindable).
    */
Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the
referenced object.   When referenceOnly = true, this is a getX reference only - not requiring that the referred
property be made bindable.  This method both ensures the property is registered with it's parent type and
adds a reference to that type in ReverseDependencies - reflecting the dependency from the type which needs
this property bindable.  When checkAnnotations is true, referenceOnly starts out false but then turns to 'true' if
this property is marked as @Bindable so that we inject it during the code-gen phase .
Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the referenced object . When referenceOnly = true this is a getX reference only - not requiring that the referred property be made bindable . This method both ensures the property is registered with it ' s parent type and adds a reference to that type in ReverseDependencies - reflecting the dependency from the type which needs this property bindable . When checkAnnotations is true referenceOnly starts out false but then turns to ' true ' if this property is marked as @Bindable so that we inject it during the code - gen phase .
public static void makeBindable(Statement expr, String propertyName, IdentifierType idType, Object boundType,
                                   Object typeForIdentifier, Object referenceType, boolean referenceOnly, boolean checkAnnotations) {
      if (boundType == null || typeForIdentifier == null || expr.getTransformed())
         return;
      Object annotType = boundType;
      if (boundType instanceof PropertyAssignment)
         boundType = ((PropertyAssignment) boundType).getAssignedProperty();
      if (idType == IdentifierType.FieldName || idType == IdentifierType.GetSetMethodInvocation) {
         if (!ModelUtil.isConstant(annotType)) {
            if (boundType instanceof ParamTypedMember)
               boundType = ((ParamTypedMember) boundType).getMemberObject();
            if (boundType instanceof VariableDefinition) {
               VariableDefinition varDef = (VariableDefinition) boundType;
               varDef.makeBindable(referenceOnly);
               JavaModel fromModel = expr.getJavaModel();
               if (fromModel != null) {
                  if (referenceType instanceof TypeDeclaration) {
                     TypeDeclaration toType = varDef.getEnclosingType();
                     JavaModel toModel = toType.getJavaModel();
                     if (toModel != null)
                        toModel.addBindDependency(toType, propertyName, fromModel.getModelTypeDeclaration(), referenceOnly);
                  }
                  else if (referenceType != null)
                     System.err.println("*** Compiled type used to inject binding dependency?");
               }
            }
            else if (boundType instanceof Field) {
               System.out.println("*** Warning; binding expression involving non-bindable field: " +
                       boundType + " in expression: " + expr.toDefinitionString());
            }
            else if (boundType instanceof IBeanMapper)
               checkForBindableCompiledField(propertyName, boundType, annotType, referenceType, expr, referenceOnly, checkAnnotations);
         }
      }
      else if (isGetOrIs(idType) && ModelUtil.getBindableAnnotation(annotType) == null && !ModelUtil.isConstant(annotType)) {
         TypeDeclaration referenceTD;
         if (boundType instanceof IMethodDefinition) {
            IMethodDefinition getMethod = ((IMethodDefinition) boundType);
            Object encType = getMethod.getDeclaringType();
            if (encType instanceof TypeDeclaration) {
               String getName = ModelUtil.getMethodName(getMethod);
               referenceTD = (TypeDeclaration) encType;
               String setName = "set" + (getName.startsWith("is") ? getName.substring(2) : getName.substring(3));
               Object setMethod = referenceTD.definesMethod(setName, Collections.singletonList(typeForIdentifier), null, null, referenceTD.isTransformedType(), false, null, null);
               if (setMethod != null) {
                  referenceTD.addPropertyToMakeBindable(propertyName, boundType, expr.getJavaModel(), referenceOnly || ModelUtil.isManualBindable(setMethod), expr);
               }
            }
            else if (encType instanceof ITypeDeclaration) {
               checkForBindableCompiledField(propertyName, boundType, annotType, referenceType, expr, referenceOnly, checkAnnotations);
            }
            else
               System.err.println("*** Can't make non-class types bindable " + encType + " for: " + propertyName);
         }
         else if (boundType instanceof IBeanMapper) {
            checkForBindableCompiledField(propertyName, boundType, annotType, referenceType, expr, referenceOnly, checkAnnotations);
         }
      }
      else if (idType == IdentifierExpression.IdentifierType.MethodInvocation) {
         checkForDynMethod(boundType, referenceType, (Expression) expr);
      }
      else if (idType == IdentifierType.BoundObjectName) {
         if (boundType instanceof BodyTypeDeclaration)
            ModelUtil.markNeedsDynAccess(boundType);
      }
   }
public static void makeBindable ( Statement expr , String propertyName , IdentifierType idType , Object boundType , Object typeForIdentifier , Object referenceType , boolean referenceOnly , boolean checkAnnotations ) { if ( boundType == null || typeForIdentifier == null || expr . getTransformed ( ) ) return ; Object annotType = boundType ; if ( boundType instanceof PropertyAssignment ) boundType = ( ( PropertyAssignment ) boundType ) . getAssignedProperty ( ) ; if ( idType == IdentifierType . FieldName || idType == IdentifierType . GetSetMethodInvocation ) { if ( ! ModelUtil . isConstant ( annotType ) ) { if ( boundType instanceof ParamTypedMember ) boundType = ( ( ParamTypedMember ) boundType ) . getMemberObject ( ) ; if ( boundType instanceof VariableDefinition ) { VariableDefinition varDef = ( VariableDefinition ) boundType ; varDef . makeBindable ( referenceOnly ) ; JavaModel fromModel = expr . getJavaModel ( ) ; if ( fromModel != null ) { if ( referenceType instanceof TypeDeclaration ) { TypeDeclaration toType = varDef . getEnclosingType ( ) ; JavaModel toModel = toType . getJavaModel ( ) ; if ( toModel != null ) toModel . addBindDependency ( toType , propertyName , fromModel . getModelTypeDeclaration ( ) , referenceOnly ) ; } else if ( referenceType != null ) System . err . println ( "*** Compiled type used to inject binding dependency?" ) ; } } else if ( boundType instanceof Field ) { System . out . println ( "*** Warning; binding expression involving non-bindable field: " + boundType + " in expression: " + expr . toDefinitionString ( ) ) ; } else if ( boundType instanceof IBeanMapper ) checkForBindableCompiledField ( propertyName , boundType , annotType , referenceType , expr , referenceOnly , checkAnnotations ) ; } } else if ( isGetOrIs ( idType ) && ModelUtil . getBindableAnnotation ( annotType ) == null && ! ModelUtil . isConstant ( annotType ) ) { TypeDeclaration referenceTD ; if ( boundType instanceof IMethodDefinition ) { IMethodDefinition getMethod = ( ( IMethodDefinition ) boundType ) ; Object encType = getMethod . getDeclaringType ( ) ; if ( encType instanceof TypeDeclaration ) { String getName = ModelUtil . getMethodName ( getMethod ) ; referenceTD = ( TypeDeclaration ) encType ; String setName = "set" + ( getName . startsWith ( "is" ) ? getName . substring ( 2 ) : getName . substring ( 3 ) ) ; Object setMethod = referenceTD . definesMethod ( setName , Collections . singletonList ( typeForIdentifier ) , null , null , referenceTD . isTransformedType ( ) , false , null , null ) ; if ( setMethod != null ) { referenceTD . addPropertyToMakeBindable ( propertyName , boundType , expr . getJavaModel ( ) , referenceOnly || ModelUtil . isManualBindable ( setMethod ) , expr ) ; } } else if ( encType instanceof ITypeDeclaration ) { checkForBindableCompiledField ( propertyName , boundType , annotType , referenceType , expr , referenceOnly , checkAnnotations ) ; } else System . err . println ( "*** Can't make non-class types bindable " + encType + " for: " + propertyName ) ; } else if ( boundType instanceof IBeanMapper ) { checkForBindableCompiledField ( propertyName , boundType , annotType , referenceType , expr , referenceOnly , checkAnnotations ) ; } } else if ( idType == IdentifierExpression . IdentifierType . MethodInvocation ) { checkForDynMethod ( boundType , referenceType , ( Expression ) expr ) ; } else if ( idType == IdentifierType . BoundObjectName ) { if ( boundType instanceof BodyTypeDeclaration ) ModelUtil . markNeedsDynAccess ( boundType ) ; } }
Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the
 referenced object.
Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the referenced object .
// Once we've been transformed, no need to add these dependencies // A lot of times the boundType is in some super-type of an annotated type in the system so we need // to get the most specific reference before we start looking for annotations. // No longer necessary because we do the resolve for assignments anyway? //Object annotType = ModelUtil.resolveAnnotationReference(expr.getJavaModel(), boundType); // TODO: need to add logic to make a compiled field bindable in a subclass, more like below // If we have a method, it means we can inject bindability by renaming the old method // Do dynamic access only if the property is marked as manually bindable. // TODO: else read-only property?  Or in this case, do we need to check the MemberOwner again? // We can have an object which is in compiled form, not anything we need to do