final ArrayList<String> comment = new ArrayList<String>();
comment.add("Java to KML\n");
comment.add("The object graph is marshalled to an OutputStream object.\n");
comment.add("The object is not saved as a zipped .kmz file.\n");
comment.add("@see marshalKmz(String, Kml...)");
final JMethod generateMarshalOutputStream = generateMarshal(cc, outputStreamClass, comment);
comment.clear();
// public boolean marshal(final Writer writer) {
// try {
// m = this.createMarshaller();
// JAXBElement<Kml> jaxbRootElement = new JAXBElement<Kml>(new QName("http://www.opengis.net/kml/2.2", "kml"), Kml.class, this);
// m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// m.marshal(jaxbRootElement, writer);
// return true;
// } catch (JAXBException _x) {
// _x.printStackTrace();
// return false;
// }
// }
comment.add("Java to KML\n");
comment.add("The object graph is marshalled to a Writer object.\n");
comment.add("The object is not saved as a zipped .kmz file.\n");
comment.add("@see marshalKmz(String, Kml...)");
generateMarshal(cc, writerClass, comment);
comment.clear();
comment.add("Java to KML\n");
comment.add("The object graph is marshalled to a Contenthandler object.\n");
comment.add("Useful if marshaller cis needed to generate CDATA blocks.\n");
comment.add("{@link https://jaxb.dev.java.net/faq/}\n");
comment.add("{@link http://code.google.com/p/javaapiforkml/issues/detail?id=7}\n");
comment.add("The object is not saved as a zipped .kmz file.\n");
comment.add("@see marshalKmz(String, Kml...)");
generateMarshal(cc, contentHandlerClass, comment);
comment.clear();
comment.add("Java to KML\n");
comment.add("The object graph is printed to the console.\n");
comment.add("(Nothing is saved, nor saved. Just printed.)\n");
generateMarshal(cc, comment);
comment.clear();
// public boolean marshal(final File filename, boolean zipped) throws FileNotFoundException {
// OutputStream out = new FileOutputStream(filename);
// if (zipped) {
// out = new ZipOutputStream(out);
// }
//
// return this.marshall(out);
// }
comment.add("Java to KML\n");
comment.add("The object graph is marshalled to a File object.\n");
comment.add("The object is not saved as a zipped .kmz file.\n");
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));
comment.clear();
// comment.add("Java to KML\n");
// comment.add("The object graph is marshalled to a File object.\n");
// comment.add("The object is not saved as a zipped .kmz file.\n");