coordinateClassConverter._extends(xmladapter);
// final JMethod stringArgConstructor = coordinateClassConverter.constructor(JMod.PRIVATE);
// toString
final JMethod marshall = coordinateClassConverter.method(JMod.PUBLIC, String.class, "marshal");
final JVar stringConstructorArg = marshall.param(JMod.FINAL, listGenericsCoordinates, "dt");
marshall._throws(Exception.class);
marshall.annotate(Override.class);
final JVar sbVarMarshall = marshall.body().decl(stringBuilderClass, "sb", JExpr._new(stringBuilderClass));
final JForEach forMarshall = marshall.body().forEach(coordinateClass, "coord", stringConstructorArg);
// forMarshall.body().add(sbVarMarshall.invoke("append").arg(forMarshall.var().name() + " + \" \""));
forMarshall.body().add(sbVarMarshall.invoke("append").arg(JExpr.direct("coord + \" \"")));
marshall.body()._return(sbVarMarshall.invoke("toString").invoke("trim"));
// toString
final JMethod unmarshall = coordinateClassConverter.method(JMod.PUBLIC, listGenericsCoordinates, "unmarshal");
final JVar unmarshallparam = unmarshall.param(JMod.FINAL, String.class, "s");
unmarshall._throws(Exception.class);
unmarshall.annotate(Override.class);
// http://code.google.com/p/javaapiforkml/issues/detail?id=10
// changed:
// String[] coords = s.replaceAll(",[ ]+?", ",").trim().split(" ");
// to:
// String[] coords = s.replaceAll(",\\s+", ",").trim().split("\\s+");
final JVar varCoords1 = unmarshall.body().decl(stringClass.array(), "coords",
unmarshallparam.invoke("replaceAll").arg(",[\\s]+").arg(",").invoke("trim").invoke("split").arg("\\s+"));
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);
}