protected void generateStaticRoleSlots(Role role, PrintWriter out) { onNewline(out); Role otherRole = role.getOtherRole(); // The Role slot String roleType = getRoleType(role); printWords(out, "public", "final", "static", roleType, getRoleHandlerName(role, false), "=", "new", roleType); print(out, "("); print(out, getRoleArgs(role)); print(out, ")"); newBlock(out); boolean multOne = (role.getMultiplicityUpper() == 1); if (multOne) { generateStaticRoleSlotsMultOne(role, otherRole, out); } else { generateStaticRoleSlotsMultStar(role, otherRole, out); } generateRoleMethodGetInverseRole(role, otherRole, out); closeBlock(out, false); println(out, ";"); }
protected void generateRoleMethodGetInverseRole(Role role, Role otherRole, PrintWriter out) { // the getInverseRole method String inverseRoleType = makeGenericType("pt.ist.fenixframework.dml.runtime.Role", getTypeFullName(role.getType()), getTypeFullName(otherRole.getType())); printMethod(out, "public", inverseRoleType, "getInverseRole"); startMethodBody(out); print(out, "return "); if (otherRole.getName() == null) { print(out, "new "); print(out, getRoleType(otherRole)); print(out, "(this)"); } else { print(out, getRoleHandlerName(otherRole, true)); } print(out, ";"); endMethodBody(out); }
print(out, genericType); print(out, "("); print(out, getRoleHandlerName(role, false)); print(out, ", \""); print(out, role.getRelation().getName());