//-- create main marshal method
JMethod jMethod = new JMethod(null,"marshal");
jMethod.addException(SGTypes.MarshalException);
jMethod.addException(SGTypes.ValidationException);
jMethod.addParameter(new JParameter(SGTypes.Writer, "out"));
parent.addMethod(jMethod);
if (isAbstract) {
jMethod.getModifiers().setAbstract(true);
}
else {
JSourceCode jsc = jMethod.getSourceCode();
jsc.add("");
jsc.add("Marshaller.marshal(this, out);");
}
//-- create helper marshal method
//-- start helper marshal method, this method will
//-- be built up as we process the given ElementDecl
jMethod = new JMethod(null, "marshal");
JClass jc = null;
if (_sax1) {
jc = new JClass("org.xml.sax.DocumentHandler");
} else {
jc = new JClass("org.xml.sax.ContentHandler");
jMethod.addException(SGTypes.IOException);
}
jMethod.addException(SGTypes.MarshalException);
jMethod.addException(SGTypes.ValidationException);
jMethod.addParameter(new JParameter(jc, "handler"));
parent.addMethod(jMethod);
if (isAbstract) {
jMethod.getModifiers().setAbstract(true);
}