}
// Iterate over all constructors and replicate them in this class
for (Iterator i = baseConstructors.iterator(); i.hasNext(); /* No ++ */) {
ConstructorInfo baseConstructor = (ConstructorInfo)i.next();
// Write the constructor comment.
GenerateUtilities.openJavaDocComment(out, " ");
GenerateUtilities.addJavaDocComment(out, " ", "Create a new <code>"
+ identityClassName + "</code>.");
List constructorParameters = baseConstructor.getParameters();
for (Iterator innerI = constructorParameters.iterator();
innerI.hasNext(); /* No ++ */) {
ParameterInfo param = (ParameterInfo)innerI.next();
String paramName = param.getName();
comment = "@param " + paramName + " " +
identityBaseClassInfo.getField(paramName, true).getComment();
GenerateUtilities.addJavaDocComment(out, " ", comment);
}
GenerateUtilities.closeJavaDocComment(out, " ");
// Write the constructor method declaration.
String startLine = " public " + identityClassName + " (";
out.print(startLine);
separator = null;
for (Iterator innerI = constructorParameters.iterator();
innerI.hasNext(); /* No ++ */) {
ParameterInfo param = (ParameterInfo)innerI.next();
// Output a parameter declaration.
if (separator == null) {
separator = ",\n" +
GenerateUtilities.getIndent(startLine.length());
} else {
out.print(separator);
}
out.print (param.getTypeName() + " " + param.getName());
}
if (identityFields.size () != 0) {
for (Iterator fieldsIterator = identityFields.iterator();
fieldsIterator.hasNext(); /**/) {
FieldInfo field = (FieldInfo)fieldsIterator.next();
if (separator == null){
separator = ",\n" +
GenerateUtilities.getIndent(startLine.length());
} else {
out.print(separator);
}
out.print (field.getTypeName() + " " + field.getName());
}
}
out.println(") {");
List parameters = baseConstructor.getParameters();
ParameterInfo firstParam = (ParameterInfo) parameters.get(0);
// If the Project is the first parameter, call the superclass
// constructor. If it isn't, call the superclass constructor with
// null for the project.