@Override protected String getRelationAwareBaseTypeFor(Role role) { if (role.isIndexed() && role.getIndexCardinality() == Role.MULTIPLICITY_MANY) { return RelationMulValuesIndexedAwareSet.class.getName(); } else { return super.getRelationAwareBaseTypeFor(role); } }
private String getSearchForKey(Role role, String retType) { boolean indexMult = role.isIndexed() && role.getIndexCardinality() == Role.MULTIPLICITY_MANY; String fetchMethod = "get" + (indexMult ? "Values" : ""); return "((" + getRelationAwareTypeFor(role) + ") get" + capitalize(role.getName()) + "Set())." + fetchMethod + "(key)"; }
@Override protected String getDefaultCollectionGetterFor(Role role) { if (role.isIndexed() && role.getIndexCardinality() == Role.MULTIPLICITY_MANY) { return makeGenericType(DomainBasedMap.Getter.class.getCanonicalName(), makeGenericType(LINKED_LIST_FULL_CLASS, getTypeFullName(role.getType()))); } else { return super.getDefaultCollectionGetterFor(role); } }
@Override protected String getDefaultCollectionFor(Role role) { if (role.isIndexed() && role.getIndexCardinality() == Role.MULTIPLICITY_MANY) { return makeGenericType(getCollectionToUse(), makeGenericType(LINKED_LIST_FULL_CLASS, role.getType().getFullName())); } else { return super.getDefaultCollectionFor(role); } }
@Override protected void generateRoleSlotMethodsMultStar(Role role, PrintWriter out) { super.generateRoleSlotMethodsMultStar(role, out); boolean isIndexed = role.isIndexed(); String typeName = getTypeFullName(role.getType()); String slotName = role.getName(); String capitalizedSlotName = capitalize(slotName); String slotAccessExpression = "get" + capitalizedSlotName + "()"; String methodModifiers = getMethodModifiers(role); if (isIndexed) { generateRoleSlotMethodsMultStarIndexed(role, out, methodModifiers, capitalizedSlotName, slotAccessExpression, typeName, slotName); } }
@Override protected void generateStaticKeyFunctionForRole(Role role, PrintWriter out) { if (role.isIndexed()) { onNewline(out); Slot indexedSlot = getIndexedSlot(role); String keyField = role.getIndexProperty(); println(out, generateMapKeyFunction(role.getName(), role.getType().getFullName(), indexedSlot.getSlotType().getFullname(), keyField, role.getIndexCardinality() == Role.MULTIPLICITY_MANY)); onNewline(out); } else { super.generateStaticKeyFunctionForRole(role, out); } }