Package com.sun.codemodel

Examples of com.sun.codemodel.JMethod.param()


      // }
      // if (fo.getPropertyInfo().isCollection()) {
      // LOG.info("!!!!! " + cc.implClass.name() + " is collection " + methodName );
      // continue;
      // }
      final JVar arg = m.param(JMod.FINAL, field.type(), field.name());
      args.arg(JExpr.ref(field.name()));
      m.javadoc().addParam(arg).append("required parameter");
      // m.body().assign(JExpr.refthis(field.name()), arg);
    }
View Full Code Here


    comment.add("@see marshalKmz(String, Kml...)");
    final JMethod generateMarshallFilenameWithZIP = cc.implClass.method(JMod.PUBLIC, cc.implClass.owner().BOOLEAN, "marshal");
    generateMarshallFilenameWithZIP._throws(FileNotFoundException.class);
    generateMarshallFilenameWithZIP.javadoc().append(comment);

    final JVar filenameVar = generateMarshallFilenameWithZIP.param(JMod.FINAL, File.class, "filename");
    // final JVar zippedVar = generateMarshallFilenameWithZIP.param(JMod.FINAL, boolean.class, "zipped");
    final JVar outVar = generateMarshallFilenameWithZIP.body().decl(outputStreamClass, "out", JExpr._new(fileOutputStreamClass).arg(filenameVar));
    // final JConditional ifBlockFilename = generateMarshallFilenameWithZIP.body()._if(zippedVar.eq(JExpr.TRUE));
    // ifBlockFilename._then().assign(outVar, JExpr._new(zipOutputStreamClass).arg(outVar));
    generateMarshallFilenameWithZIP.body()._return(JExpr._this().invoke(generateMarshalOutputStream).arg(outVar));
View Full Code Here

    final JMethod generateMarshalOutputStream = cc.implClass.method(JMod.PUBLIC, cc.implClass.owner().BOOLEAN, "marshal");
    if (argumentType.equals(outputStreamClass)) {
      generateMarshalOutputStream._throws(FileNotFoundException.class);
    }
    generateMarshalOutputStream.javadoc().append(comment);
    final JVar value = generateMarshalOutputStream.param(JMod.FINAL, argumentType, argumentType.name().toLowerCase());

    // try {
    final JTryBlock tryBlock = generateMarshalOutputStream.body()._try();
    // m = this.createMarshaller();
    tryBlock.body().assign(mVar, JExpr._this().invoke(createMashaller));
View Full Code Here

    generateUnMarshallerFromString.javadoc().add("reads legacy kml files. \n");
    generateUnMarshallerFromString.javadoc().add("Supported are KML 2.0 (namespace: http://earth.google.com/kml/2.0) \n");
    generateUnMarshallerFromString.javadoc().add("          and KML 2.1 (namespace: http://earth.google.com/kml/2.1) \n");
    generateUnMarshallerFromString.javadoc().trimToSize();
   
    final JVar fileunmarshallVar = generateUnMarshallerFromString.param(JMod.FINAL, fileClass, "file");
    generateUnMarshallerFromString._throws(FileNotFoundException.class);
    final JTryBlock tryBlock = generateUnMarshallerFromString.body()._try();
    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
View Full Code Here

    final JMethod unmarshalFromKMZ = cc.implClass.method(JMod.PUBLIC | JMod.STATIC, kmlClass.array(), "unmarshalFromKmz");
    unmarshalFromKMZ.javadoc().add("KMZ to Java\n");
    unmarshalFromKMZ.javadoc().add("Similar to the other unmarshal methods\n\n");
    unmarshalFromKMZ.javadoc().add("with the exception that it transforms a KMZ-file into a graph of Java objects. \n")
    unmarshalFromKMZ._throws(IOException.class);
    final JVar varFile = unmarshalFromKMZ.param(fileClass, "file");
    varFile.annotate(NotNull.class);
    final JVar varEMPTY_KML_ARRAY = unmarshalFromKMZ.body().decl(kmlClass.array(), "EMPTY_KML_ARRAY", JExpr.direct("new Kml[0]"));// JExpr._new(kmlClass.array().)..arg("0"));
    unmarshalFromKMZ.body()._if(varFile.invoke("getName").invoke("endsWith").arg(".kmz").not())._then()._return(varEMPTY_KML_ARRAY);
    final JVar varZip = unmarshalFromKMZ.body().decl(zipFileClass, "zip",JExpr._new(zipFileClass).arg(varFile) );
    final JVar varEntries = unmarshalFromKMZ.body().decl(enumerationClass.boxify().narrow(zipEntryClass.boxify().wildcard()), "entries", varZip.invoke("entries"));
View Full Code Here

    // out.close();
    // missingNameCounter = 1;
    // return false;
    // }
    final JMethod generateMarshalKmz = cc.implClass.method(JMod.PUBLIC, cc.implClass.owner().BOOLEAN, "marshalAsKmz");
    final JVar varName = generateMarshalKmz.param(stringClass, "name");
    varName.annotate(NotNull.class);
    final JVar varAdditionalFiles = generateMarshalKmz.varParam(kmlClass.boxify(), "additionalFiles");
    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/"));
View Full Code Here

    generateUnMarshallerFromString.javadoc().add("KML to Java\n");
    generateUnMarshallerFromString.javadoc().add("Similar to the other unmarshal methods \n\n");
    generateUnMarshallerFromString.javadoc().add(
        "with the exception that it transforms a " + invokeMarshalWith.name() + " into a graph of Java objects. \n");
    generateUnMarshallerFromString.javadoc().trimToSize();
    final JVar stringunmarshallVar = generateUnMarshallerFromString.param(JMod.FINAL, invokeMarshalWith, "content");

    final JTryBlock tryStringBlock = generateUnMarshallerFromString.body()._try();
    final JVar localUnmarshaller = tryStringBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
View Full Code Here

    final JMethod generateUnMarshallerFromString = cc.implClass.method(JMod.PUBLIC | JMod.STATIC, kmlClass, "unmarshal");
    generateUnMarshallerFromString.javadoc().add("KML to Java\n");
    generateUnMarshallerFromString.javadoc().add("Similar to the other unmarshal methods \n\n");
    generateUnMarshallerFromString.javadoc().add("with the exception that it transforms a String into a graph of Java objects. \n");
    generateUnMarshallerFromString.javadoc().trimToSize();
    final JVar stringunmarshallVar = generateUnMarshallerFromString.param(JMod.FINAL, stringClass, "content");

    final JTryBlock tryStringBlock = generateUnMarshallerFromString.body()._try();
    final JVar localUnmarshaller = tryStringBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
   
View Full Code Here

    generateUnMarshallerFileFile.javadoc().add("KML given as a file object is transformed into a graph of Java objects.\n");
    generateUnMarshallerFileFile.javadoc().add("The boolean value indicates, whether the File object should be validated \n");
    generateUnMarshallerFileFile.javadoc().add("automatically during unmarshalling and be checked if the object graph meets \n");
    generateUnMarshallerFileFile.javadoc().add("all constraints defined in OGC's KML schema specification.");
    generateUnMarshallerFileFile.javadoc().trimToSize();
    final JVar fileunmarshallVar = generateUnMarshallerFileFile.param(JMod.FINAL, fileClass, "file");
    final JVar validateVar = generateUnMarshallerFileFile.param(JMod.FINAL, boolean.class, "validate");

    final JTryBlock tryBlock = generateUnMarshallerFileFile.body()._try();
    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
View Full Code Here

    generateUnMarshallerFileFile.javadoc().add("The boolean value indicates, whether the File object should be validated \n");
    generateUnMarshallerFileFile.javadoc().add("automatically during unmarshalling and be checked if the object graph meets \n");
    generateUnMarshallerFileFile.javadoc().add("all constraints defined in OGC's KML schema specification.");
    generateUnMarshallerFileFile.javadoc().trimToSize();
    final JVar fileunmarshallVar = generateUnMarshallerFileFile.param(JMod.FINAL, fileClass, "file");
    final JVar validateVar = generateUnMarshallerFileFile.param(JMod.FINAL, boolean.class, "validate");

    final JTryBlock tryBlock = generateUnMarshallerFileFile.body()._try();
    final JVar localUnmarshallerFile = tryBlock.body().decl(jaxbUnmarshallerClass, "unmarshaller",
        jaxbContextClass.boxify().staticInvoke("newInstance").arg(JExpr.direct("Kml.class")).invoke("createUnmarshaller"));
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.