String documentation = "";
if (elements != null)
{
if (elements != null && i < (elements.size()*2))
{
ElementDecl elem = (ElementDecl)elements.get(i/2);
documentation = elem.getDocumentation();
}
}
String get = "get";
if (typeName.equals("boolean")) {
get = "is";
}
String comment = getJavadocDescriptionPart(documentation, true);
if (comment.length() > 3) {
// remove the " *" at the front of the first line
comment = comment.substring(2);
}
if (enableGetters) {
try {
pw.println();
pw.println(" /**");
pw.println(" * Gets the " + name + " value for this " + getClassName() + ".");
pw.println(" * ");
pw.println(" * @return " + name + comment);
pw.println(" */");
} catch (DOMException e) {
// no comment
}
pw.println(" public " + typeName + " " + get + capName
+ "() {");
if (isUnion()) {
writeSimpleTypeGetter(typeName, name, "return");
} else {
pw.println(" return " + name + ";");
}
pw.println(" }");
pw.println();
}
if (enableSetters) {
try
{
String nm = (isUnion()) ? "_value" : name;
pw.println();
pw.println(" /**");
pw.println(" * Sets the " + nm + " value for this " + getClassName() + ".");
pw.println(" * ");
pw.println(" * @param " + nm + comment);
pw.println(" */");
}
catch (DOMException e)
{
// no comment
}
if (isUnion()) {
pw.println(" public void set" + capName + "(" + typeName
+ " _value) {");
writeSimpleTypeSetter(typeName);
} else {
pw.println(" public void set" + capName + "(" + typeName
+ " " + name + ") {");
pw.println(" this." + name + " = " + name + ";");
}
pw.println(" }");
pw.println();
}
// If this is a special collection type, insert extra
// java code so that the serializer/deserializer can recognize
// the class. This is not JAX-RPC, and will be replaced with
// compliant code when JAX-RPC determines how to deal with this case.
// These signatures comply with Bean Indexed Properties which seems
// like the reasonable approach to take for collection types.
// (It may be more efficient to handle this with an ArrayList...but
// for the initial support it was easier to use an actual array.)
if ((elements != null) && (j < elements.size())) {
ElementDecl elem = (ElementDecl) elements.get(j);
if (elem.getType().getQName().getLocalPart().indexOf("[") > 0) {
String compName =
typeName.substring(0, typeName.lastIndexOf("["));
if (enableGetters) {
pw.println(" public " + compName + " " + get