if (fieldName.contains(".")) {
List<String> parts = Arrays.asList(fieldName.split("\\."));
ReferenceField referenceField = (ReferenceField) fields.get(parts.get(0));
ModelManager manager = modelClass.getDb().getModelClass(referenceField.getReferenceModelName()).getManager();
String tail = concat(parts.subList(1, parts.size()), ".").toString();
ForeignField foreignField = new ForeignField(referenceField, manager.getField(tail));
foreignField.config(fieldName, this);
return foreignField;
} else {
return fields.get(fieldName);
}
}