Package com.sun.codemodel

Examples of com.sun.codemodel.JForEach.var()


        }

        clone.body().assign(copy.ref(jFieldVar),
            JExpr._new(arrayList.narrow(clazz)).arg(JExpr.direct("get" + Util.upperFirst(jFieldVar.name()) + "().size()")));
        final JForEach forEach = clone.body().forEach(clazz, "iter", jFieldVar);
        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
View Full Code Here


        }

        clone.body().assign(copy.ref(jFieldVar),
            JExpr._new(arrayList.narrow(clazz)).arg(JExpr.direct("get" + Util.upperFirst(jFieldVar.name()) + "().size()")));
        final JForEach forEach = clone.body().forEach(clazz, "iter", jFieldVar);
        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
View Full Code Here

        }

        clone.body().assign(copy.ref(jFieldVar),
            JExpr._new(arrayList.narrow(clazz)).arg(JExpr.direct("get" + Util.upperFirst(jFieldVar.name()) + "().size()")));
        final JForEach forEach = clone.body().forEach(clazz, "iter", jFieldVar);
        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
View Full Code Here

        clone.body().assign(copy.ref(jFieldVar),
            JExpr._new(arrayList.narrow(clazz)).arg(JExpr.direct("get" + Util.upperFirst(jFieldVar.name()) + "().size()")));
        final JForEach forEach = clone.body().forEach(clazz, "iter", jFieldVar);
        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
        }
View Full Code Here

        clone.body().assign(copy.ref(jFieldVar),
            JExpr._new(arrayList.narrow(clazz)).arg(JExpr.direct("get" + Util.upperFirst(jFieldVar.name()) + "().size()")));
        final JForEach forEach = clone.body().forEach(clazz, "iter", jFieldVar);
        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
        }
      } else {
View Full Code Here

        final JForEach forEach = clone.body().forEach(clazz, "iter", jFieldVar);
        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
        }
      } else {
        final JExpression cond = JOp.cond(jFieldVar.eq(JExpr._null()), JExpr._null(), JExpr.cast(jFieldVar.type(), jFieldVar.invoke("clone")));
        clone.body().assign(copy.ref(jFieldVar), cond);
View Full Code Here

        if (forEach.var().type().fullName().equals("java.lang.Object") || enums.contains(forEach.var().type().fullName()) || forEach.var().type().fullName().equals("java.lang.String") ){
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var()));
          LOG.info("444a>>>>>>>" + forEach.var().type().fullName());
        } else {
          forEach.body().add(copy.ref(jFieldVar).invoke("add").arg(forEach.var().invoke("clone")));
          LOG.info("444b>>>>>>>" + forEach.var().type().fullName()+".clone()");
        }
      } else {
        final JExpression cond = JOp.cond(jFieldVar.eq(JExpr._null()), JExpr._null(), JExpr.cast(jFieldVar.type(), jFieldVar.invoke("clone")));
        clone.body().assign(copy.ref(jFieldVar), cond);
        LOG.info(jFieldVar.type().fullName());
View Full Code Here

    final JVar coordinateslist = unmarshall.body().decl(listGenericsCoordinates, "coordinates", JExpr._new(arraylistGenericsCoordinates));
    unmarshall.body()._if(JExpr.ref(varCoords1.name()).ref("length").lte(JExpr.lit(0)))._then().block()._return(coordinateslist);

    final JForEach forUnMarshall = unmarshall.body().forEach(stringClass, "string", varCoords1);
    forUnMarshall.body().add(coordinateslist.invoke("add").arg(JExpr._new(coordinateClass).arg(forUnMarshall.var())));
    unmarshall.body()._return(coordinateslist);
  }

  private void addSimpleSetterAndGetter(final JDefinedClass coordinateClass, final JFieldVar arg) {
    final JMethod getMethod = coordinateClass.method(JMod.PUBLIC, cm.DOUBLE, "get" + Util.upperFirst(arg.name()));
View Full Code Here

    generateMarshalKmz._throws(IOException.class);
    final JVar varOut = generateMarshalKmz.body().decl(zipOutputStreamClass, "out", JExpr._new(zipOutputStreamClass).arg(JExpr._new(fileOutputStreamClass).arg(varName)));
    generateMarshalKmz.body().add(varOut.invoke("setComment").arg("KMZ-file created with Java API for KML. Visit us: http://code.google.com/p/javaapiforkml/"));
    generateMarshalKmz.body().add(JExpr._this().invoke(createAddToKmzFile).arg(JExpr._this()).arg(varOut).arg(JExpr.TRUE));
    final JForEach forEach = generateMarshalKmz.body().forEach(kmlClass, "kml", varAdditionalFiles);
    forEach.body().add(JExpr._this().invoke(createAddToKmzFile).arg(forEach.var()).arg(varOut).arg(JExpr.FALSE));
    generateMarshalKmz.body().add(varOut.invoke("close"));
    generateMarshalKmz.body().assign(varMissingNameCounter,JExpr.lit(1));
    generateMarshalKmz.body()._return(JExpr.FALSE);
  }
View Full Code Here

                JMethod m = type.method(JMod.PUBLIC|JMod.STATIC , type, "fromValue" );
                JVar $v = m.param(baseExposedType,"v");
                JForEach fe = m.body().forEach(type,"c", type.staticInvoke("values") );
                JExpression eq;
                if(baseExposedType.isPrimitive())
                    eq = fe.var().ref($value).eq($v);
                else
                    eq = fe.var().ref($value).invoke("equals").arg($v);

                fe.body()._if(eq)._then()._return(fe.var());
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.