Examples of JFieldRef


Examples of com.google.gwt.dev.jjs.ast.JFieldRef

      // Make a copy to avoid concurrent modification.
      for (JStatement stmt : new ArrayList<JStatement>(block.getStatements())) {
        if (stmt instanceof JDeclarationStatement) {
          JVariableRef ref = ((JDeclarationStatement) stmt).getVariableRef();
          if (ref instanceof JFieldRef) {
            JFieldRef enumRef = (JFieldRef) ref;
            // See if LHS is a field ref to the class being initialized.
            JField field = enumRef.getField();
            if (field.isStatic() && field.getEnclosingType() == enclosingType) {
              if (field instanceof JEnumField || field.getName().equals("$VALUES")) {
                block.removeStmt(removeIndex--);
                field.setInitializer(null);
              }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JFieldRef

      boolean isStatic = x.getField().isStatic();
      if (isStatic && instance != null) {
        // this doesn't really belong here, but while we're here let's remove
        // non-side-effect qualifiers to statics
        if (!instance.hasSideEffects()) {
          JFieldRef fieldRef = new JFieldRef(program, x.getSourceInfo(), null,
              x.getField(), x.getEnclosingType());
          ctx.replaceMe(fieldRef);
        }
      } else if (!isStatic && instance.getType() == typeNull) {
        if (!instance.hasSideEffects()) {
          instance = program.getLiteralNull();
        }
        JFieldRef fieldRef = new JFieldRef(program, x.getSourceInfo(),
            instance, program.getNullField(), null,
            primitiveTypeOrNullType(x.getType()));
        ctx.replaceMe(fieldRef);
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JFieldRef

        }
      } else {
        field = (JField) typeMap.get(fieldBinding);
      }
      JExpression instance = dispProcessExpression(x.receiver);
      JExpression fieldRef = new JFieldRef(program, info, instance, field,
          currentClass);

      if (x.genericCast != null) {
        JType castType = (JType) typeMap.get(x.genericCast);
        /*
 
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JFieldRef

                  "Error matching fieldBinding.");
            }
          } else {
            field = (JField) typeMap.get(fieldBinding);
          }
          curRef = new JFieldRef(program, info, curRef, field, currentClass);
          if (x.otherGenericCasts != null && x.otherGenericCasts[i] != null) {
            JType castType = (JType) typeMap.get(x.otherGenericCasts[i]);
            curRef = maybeCast(castType, curRef);
          }
        }
View Full Code Here

Examples of com.sun.codemodel.JFieldRef

        dc.methods().remove(method);

        method = dc.method(mods, mtype, getterName);
        method.javadoc().append(doc);

        JFieldRef fr = JExpr.ref(fieldName);
        if (dvExpr != null) {
            JExpression test = JOp.eq(JExpr._null(), fr);
            JConditional jc =  method.body()._if(test);
            jc._then()._return(dvExpr);
            jc._else()._return(fr);
View Full Code Here

Examples of com.sun.codemodel.JFieldRef

        method = dc.method(mods, method.type(), setterName);
       
        method.javadoc().append(doc);
        method.param(mtype, "value");

        JFieldRef fr = JExpr.ref(fieldName);
        method.body().assign(fr, JExpr.ref("value"));
       
        method = dc.method(mods, method.type(), "unset" + fo.getPropertyInfo().getName(true));
        method.body().assign(fr, JExpr._null());
       
View Full Code Here

Examples of com.sun.codemodel.JFieldRef

        dc.methods().remove(method);

        method = dc.method(mods, mtype, getterName);
        method.javadoc().append(doc);

        JFieldRef fr = JExpr.ref(fieldName);
        if (dvExpr != null) {
            JExpression test = JOp.eq(JExpr._null(), fr);
            JConditional jc =  method.body()._if(test);
            jc._then()._return(dvExpr);
            jc._else()._return(fr);
View Full Code Here

Examples of com.sun.codemodel.JFieldRef

        method = dc.method(mods, method.type(), setterName);
       
        method.javadoc().append(doc);
        method.param(mtype, "value");

        JFieldRef fr = JExpr.ref(fieldName);
        method.body().assign(fr, JExpr.ref("value"));
       
        method = dc.method(mods, method.type(), "unset" + fo.getPropertyInfo().getName(true));
        method.body().assign(fr, JExpr._null());
       
View Full Code Here

Examples of com.sun.codemodel.JFieldRef

        LOG.fine("Running toString() plugin.");
       
        final JClass toStringDelegateImpl = outline.getCodeModel()
            .ref("org.apache.cxf.jaxb.JAXBToStringBuilder");
        final JClass styleClass = outline.getCodeModel().ref("org.apache.cxf.jaxb.JAXBToStringStyle");
        final JFieldRef toStringDelegateStyleParam = styleClass.staticRef(styleFieldName);
       
        for (ClassOutline co : outline.getClasses()) {
            addToStringMethod(co, toStringDelegateImpl, toStringDelegateStyleParam);
        }
       
View Full Code Here

Examples of com.sun.codemodel.JFieldRef

    // ir all works out, the objects are equal, return true
    equalsMethod.body()._return(JExpr.TRUE);

    // useful fields
    final JFieldRef vPrime = JExpr.ref("prime");
    final JFieldRef vResult = JExpr.ref("result");

    // ==> final int prime = 31;
    hashCodeMethod.body().assign(JExpr.ref("final int prime"), JExpr.ref("31"));

    // ==> int result = 1; || int result = super.hashCode();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.