示例#1
0
 /**
  * Generates code for a single attribute.
  *
  * @param attr the AttributeDescriptor
  * @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(AttributeDescriptor attr, boolean field) {
   StringBuffer sb = new StringBuffer();
   if (field) {
     sb.append(
             INDENT
                 + "// Attr: "
                 + attr.getClassDescriptor().getName()
                 + "."
                 + attr.getName()
                 + ENDL)
         .append(INDENT + "protected ")
         .append(attr.getType())
         .append(" ")
         .append(attr.getName())
         .append(";" + ENDL);
   }
   sb.append(generateGetSet(attr, field)).append(ENDL);
   return sb.toString();
 }