final CPropertyInfo property = fieldOutline.getPropertyInfo();
final StringBuffer methodName = new StringBuffer();
final ArrayList<String> javadoc = new ArrayList<String>();
methodName.append("createAnd");
JInvocation methodInvoke = null;
if (property.isCollection()) {
methodName.append("Add");
methodInvoke = JExpr._this().invoke("get" + property.getName(true)).invoke("add").arg(JExpr.ref(localName));
javadoc.add("and adds it to " + property.getName(false) + ".");
javadoc.add("\n");
javadoc.add("This method is a short version for:\n");
javadoc.add("<code>\n");
javadoc.add("" + cClassInfo.name() + " " + Util.lowerFirst(cClassInfo.name()) + " = new " + cClassInfo.name() + "();\n");
javadoc.add("this.get" + property.getName(true) + "().add(" + Util.lowerFirst(cClassInfo.name()) + ");");
javadoc.add("</code>\n");
} else {
methodName.append("Set");
methodInvoke = JExpr._this().invoke("set" + property.getName(true)).arg(JExpr.ref(localName));
javadoc.add("and set it to " + property.getName(false) + ".\n");
javadoc.add("\n");
javadoc.add("This method is a short version for:\n");
javadoc.add("<code>\n");
javadoc.add("" + cClassInfo.name() + " " + Util.lowerFirst(cClassInfo.name()) + " = new " + cClassInfo.name() + "();\n");
javadoc.add("this.set" + property.getName(true) + "(" + Util.lowerFirst(cClassInfo.name()) + ");");
javadoc.add("</code>\n");
}
// cClassInfo
final ClassOutlineImpl asClass = classList.get(cClassInfo.fullName());
final Collection<JFieldVar> relevantFields = Util.getConstructorRequiredFields(asClass);
final Map<String, FieldOutline> fieldOutlineasMap = Util.getRequiredFieldsAsMap(cc);
final JMethod m = implClass.method(JMod.PUBLIC, cClassInfo, methodName.toString() + shortName);
final JInvocation args = JExpr._new(cClassInfo);
for (final JFieldVar field : relevantFields) {
// FieldOutline fo = fieldOutlineasMap.get(field.name());
// if (fo == null) {
// continue;
// }
// if (fo.getPropertyInfo().isCollection()) {
// LOG.info("!!!!! " + cc.implClass.name() + " is collection " + methodName );
// continue;
// }
final JVar arg = m.param(JMod.FINAL, field.type(), field.name());
args.arg(JExpr.ref(field.name()));
m.javadoc().addParam(arg).append("required parameter");
// m.body().assign(JExpr.refthis(field.name()), arg);
}
m.body().decl(cClassInfo, localName, args);