@Nullable private IndexDefinitionHolder createIndexDefinitionHolderForProperty(String dotPath, String collection, MongoPersistentProperty persistentProperty) { if (persistentProperty.isAnnotationPresent(Indexed.class)) { return createIndexDefinition(dotPath, collection, persistentProperty); } else if (persistentProperty.isAnnotationPresent(GeoSpatialIndexed.class)) { return createGeoSpatialIndexDefinition(dotPath, collection, persistentProperty); } return null; }
private void resolveAndAddIndexesForAssociation(Association<MongoPersistentProperty> association, List<IndexDefinitionHolder> indexes, String path, String collection) { MongoPersistentProperty property = association.getInverse(); String propertyDotPath = (StringUtils.hasText(path) ? path + "." : "") + property.getFieldName(); if (property.isAnnotationPresent(GeoSpatialIndexed.class) || property.isAnnotationPresent(TextIndexed.class)) { throw new MappingException( String.format("Cannot create geospatial-/text- index on DBRef in collection '%s' for path '%s'.", collection, propertyDotPath)); } IndexDefinitionHolder indexDefinitionHolder = createIndexDefinitionHolderForProperty(propertyDotPath, collection, property); if (indexDefinitionHolder != null) { indexes.add(indexDefinitionHolder); } }
private boolean isSpherical(MongoPersistentProperty property) { if (property.isAnnotationPresent(GeoSpatialIndexed.class)) { GeoSpatialIndexed index = property.findAnnotation(GeoSpatialIndexed.class); return index.type().equals(GeoSpatialIndexType.GEO_2DSPHERE); } return false; }
@Nullable private IndexDefinitionHolder createIndexDefinitionHolderForProperty(String dotPath, String collection, MongoPersistentProperty persistentProperty) { if (persistentProperty.isAnnotationPresent(Indexed.class)) { return createIndexDefinition(dotPath, collection, persistentProperty); } else if (persistentProperty.isAnnotationPresent(GeoSpatialIndexed.class)) { return createGeoSpatialIndexDefinition(dotPath, collection, persistentProperty); } return null; }
private void resolveAndAddIndexesForAssociation(Association<MongoPersistentProperty> association, List<IndexDefinitionHolder> indexes, String path, String collection) { MongoPersistentProperty property = association.getInverse(); String propertyDotPath = (StringUtils.hasText(path) ? path + "." : "") + property.getFieldName(); if (property.isAnnotationPresent(GeoSpatialIndexed.class) || property.isAnnotationPresent(TextIndexed.class)) { throw new MappingException( String.format("Cannot create geospatial-/text- index on DBRef in collection '%s' for path '%s'.", collection, propertyDotPath)); } IndexDefinitionHolder indexDefinitionHolder = createIndexDefinitionHolderForProperty(propertyDotPath, collection, property); if (indexDefinitionHolder != null) { indexes.add(indexDefinitionHolder); } }
private boolean isSpherical(MongoPersistentProperty property) { if (property.isAnnotationPresent(GeoSpatialIndexed.class)) { GeoSpatialIndexed index = property.findAnnotation(GeoSpatialIndexed.class); return index.type().equals(GeoSpatialIndexType.GEO_2DSPHERE); } return false; }