protected String generateMapKeyFunction(String roleName, String valueType, String keyType, String keyField, boolean allowMultipleKeys) { String format = "private static pt.ist.fenixframework.dml.runtime.KeyFunction<%keyType%,%valueType%> keyFunction$$%roleName% = new pt.ist.fenixframework.dml.runtime.KeyFunction<%keyType%,%valueType%>() { public %keyType% getKey(%valueType% value) { return value.get%keyField%(); } public boolean allowMultipleKeys() {return %multKeys%; }};"; return format.replaceAll("%roleName%", roleName).replaceAll("%valueType%", valueType) .replaceAll("%keyType%", getReferenceType(keyType)).replaceAll("%keyField%", capitalize(keyField)) .replaceAll("%multKeys%", allowMultipleKeys ? "true" : "false"); }