use of dev.morphia.annotations.Version in project morphia by mongodb.
the class PropertyModelBuilder method discoverMappedName.
public PropertyModelBuilder discoverMappedName() {
MapperOptions options = mapper.getOptions();
Property property = getAnnotation(Property.class);
Reference reference = getAnnotation(Reference.class);
Version version = getAnnotation(Version.class);
if (hasAnnotation(Id.class)) {
mappedName("_id");
} else if (property != null && !property.value().equals(Mapper.IGNORED_FIELDNAME)) {
mappedName(property.value());
} else if (reference != null && !reference.value().equals(Mapper.IGNORED_FIELDNAME)) {
mappedName(reference.value());
} else if (version != null && !version.value().equals(Mapper.IGNORED_FIELDNAME)) {
mappedName(version.value());
} else {
mappedName(options.getFieldNaming().apply(name()));
}
return this;
}
Aggregations