use of dev.morphia.annotations.experimental.IdField in project morphia by mongodb.
the class ConfigureProperties method apply.
@Override
public void apply(Mapper mapper, EntityModelBuilder modelBuilder) {
MapperOptions options = mapper.getOptions();
processProperties(modelBuilder, options);
if (modelBuilder.idPropertyName() == null) {
IdField idProperty = modelBuilder.getAnnotation(IdField.class);
if (idProperty != null) {
modelBuilder.idPropertyName(idProperty.value());
PropertyModelBuilder propertyModelBuilder = modelBuilder.propertyModelByName(idProperty.value());
propertyModelBuilder.mappedName("_id");
}
}
}
Aggregations