protected String getRelationMethodNameFor(Role role, boolean direct) { // when the two roles of a relation are played by the same class, // we need to give different names to the relation slots because both // will be in the same class return "getRelation" + role.getRelation().getName() + "()" + (direct ? "" : ".getInverseRelation()"); }
protected void generateRelationAddMethodCall(Role role, String otherArg, String indexParam, PrintWriter out) { print(out, getRelationMethodNameFor(role, true)); print(out, ".add("); if (role.isDirect()) { print(out, "("); print(out, getEntityFullName(role.getOtherRole().getType())); print(out, ")this, "); print(out, otherArg); } else { print(out, otherArg); print(out, ", ("); print(out, getEntityFullName(role.getOtherRole().getType())); print(out, ")this"); } print(out, ");"); }
protected void generateRelationRemoveMethodCall(Role role, String otherArg, PrintWriter out) { print(out, getRelationMethodNameFor(role, true)); print(out, ".remove("); if (role.isDirect()) { print(out, "("); print(out, getEntityFullName(role.getOtherRole().getType())); print(out, ")this, "); print(out, otherArg); } else { print(out, otherArg); print(out, ", ("); print(out, getEntityFullName(role.getOtherRole().getType())); print(out, ")this"); } print(out, ");"); }
boolean isDirectRelation = role.isDirect();
super.generateStaticRelationSlots(role, out); if (role.isDirect()) { String relationName = role.getRelation().getName();