/** * Generates code for a single collection. * * @param col the CollectionDescriptor * @param field true if the class should have the associated field, or false if the field is in * the superclass * @return java code */ protected String generate(CollectionDescriptor col, boolean field) { String type = "java.util.Set<" + col.getReferencedClassName() + ">"; String impl = "java.util.HashSet<" + col.getReferencedClassName() + ">"; StringBuffer sb = new StringBuffer(); if (field) { sb.append( INDENT + "// Col: " + col.getClassDescriptor().getName() + "." + col.getName() + ENDL) .append(INDENT) .append("protected ") .append(type) .append(" ") .append(col.getName()) .append(" = new ") .append(impl) .append("();" + ENDL); } sb.append(generateGetSet(col, field)).append(ENDL); return sb.toString(); }