protected String getCollectionTypeFor(Role role) { boolean indexed = (role.getIndexProperty() != null); boolean ordered = role.isOrdered(); if (indexed && ordered) { throw new Error("Can't handle roles that are both indexed and ordered"); } String elemsType = getTypeFullName(role.getType()); if (indexed) { // FIXME: the type of the key should correspond to the type of the index property return makeGenericType("java.util.Map", "java.lang.Object", elemsType); } else { return makeGenericType("java.util.Set", elemsType); } }
protected String getDefaultCollectionGetterFor(Role role) { return makeGenericType(DomainBasedMap.Getter.class.getCanonicalName(), getTypeFullName(role.getType())); }
protected String getSetTypeDeclarationFor(Role role) { String elemType = getTypeFullName(role.getType()); return makeGenericType("java.util.Set", elemType); }
protected void generateRelationGetter(String getterName, Role role, PrintWriter out) { String paramListType = makeGenericType("java.util.Set", getTypeFullName(role.getType())); generateRelationGetter(getterName, role, paramListType, out); }
protected String getDefaultCollectionFor(Role role) { return makeGenericType(getCollectionToUse(), role.getType().getFullName()); }
protected String getConcreteSetTypeDeclarationFor(Role role) { String elemType = getTypeFullName(role.getType()); String thisType = getTypeFullName(role.getOtherRole().getType()); return makeGenericType(getRelationAwareBaseTypeFor(role), thisType, elemType); }
protected String getRoleType(Role role) { return makeGenericType(getRoleBaseType(role), getTypeFullName(role.getOtherRole().getType()), getTypeFullName(role.getType())); }
protected String getRelationAwareTypeFor(Role role) { String elemType = getTypeFullName(role.getType()); String thisType = getTypeFullName(role.getOtherRole().getType()); return makeGenericType(getRelationAwareBaseTypeFor(role), thisType, elemType); }
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); }
protected void generateStaticRoleSlotsMultStar(Role role, Role otherRole, PrintWriter out) { print(out, "public "); print(out, makeGenericType("pt.ist.fenixframework.dml.runtime.RelationBaseSet", getTypeFullName(role.getType()))); print(out, " "); print(out, "getSet("); print(out, getTypeFullName(otherRole.getType())); print(out, " o1)"); startMethodBody(out); print(out, "return (" + getConcreteSetTypeDeclarationFor(role) + ") (("); print(out, otherRole.getType().getBaseName()); print(out, ") o1)."); print(out, role.getName()); print(out, ";"); endMethodBody(out); }