/** * Converts the given source Object to a mongo type with the type information of the original source type omitted. * Subclasses may overwrite this method to retain the type information of the source type on the resulting mongo type. * * @param source * @param entity * @return the converted mongo type or null if source is null */ @Nullable protected Object delegateConvertToMongoType(Object source, @Nullable MongoPersistentEntity<?> entity) { return converter.convertToMongoType(source, entity == null ? null : entity.getTypeInformation()); }
private TypeInformation<?> getTypeHintForEntity(@Nullable Object source, MongoPersistentEntity<?> entity) { TypeInformation<?> info = entity.getTypeInformation(); Class<?> type = info.getActualType().getType(); if (source == null || type.isInterface() || java.lang.reflect.Modifier.isAbstract(type.getModifiers())) { return info; } if (source instanceof Collection) { return NESTED_DOCUMENT; } if (!type.equals(source.getClass())) { return info; } return NESTED_DOCUMENT; }
private Mono<Void> checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { List<Mono<?>> publishers = new ArrayList<>(); if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinition indexDefinition : indexResolver.resolveIndexFor(entity.getTypeInformation())) { IndexDefinitionHolder indexToCreate = indexDefinition instanceof IndexDefinitionHolder ? (IndexDefinitionHolder) indexDefinition : new IndexDefinitionHolder("", indexDefinition, entity.getCollection()); publishers.add(createIndex(indexToCreate)); } } return publishers.isEmpty() ? Mono.empty() : Flux.merge(publishers).then(); }
private void checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinition indexDefinition : indexResolver.resolveIndexFor(entity.getTypeInformation())) { JustOnceLogger.logWarnIndexCreationConfigurationChange(this.getClass().getName()); IndexDefinitionHolder indexToCreate = indexDefinition instanceof IndexDefinitionHolder ? (IndexDefinitionHolder) indexDefinition : new IndexDefinitionHolder("", indexDefinition, entity.getCollection()); createIndex(indexToCreate); } } }
PropertyPath path = PropertyPath.from(pathExpression.replaceAll("\\.\\d+", ""), entity.getTypeInformation());
/** * Converts the given source Object to a mongo type with the type information of the original source type omitted. * Subclasses may overwrite this method to retain the type information of the source type on the resulting mongo type. * * @param source * @param entity * @return the converted mongo type or null if source is null */ @Nullable protected Object delegateConvertToMongoType(Object source, @Nullable MongoPersistentEntity<?> entity) { return converter.convertToMongoType(source, entity == null ? null : entity.getTypeInformation()); }
private TypeInformation<?> getTypeHintForEntity(@Nullable Object source, MongoPersistentEntity<?> entity) { TypeInformation<?> info = entity.getTypeInformation(); Class<?> type = info.getActualType().getType(); if (source == null || type.isInterface() || java.lang.reflect.Modifier.isAbstract(type.getModifiers())) { return info; } if (source instanceof Collection) { return NESTED_DOCUMENT; } if (!type.equals(source.getClass())) { return info; } return NESTED_DOCUMENT; }
private Mono<Void> checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { List<Mono<?>> publishers = new ArrayList<>(); if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinitionHolder indexToCreate : indexResolver.resolveIndexFor(entity.getTypeInformation())) { publishers.add(createIndex(indexToCreate)); } } return publishers.isEmpty() ? Mono.empty() : Flux.merge(publishers).then(); }
private void checkForAndCreateIndexes(MongoPersistentEntity<?> entity) { if (entity.isAnnotationPresent(Document.class)) { for (IndexDefinitionHolder indexToCreate : indexResolver.resolveIndexFor(entity.getTypeInformation())) { createIndex(indexToCreate); } } }
PropertyPath path = PropertyPath.from(pathExpression.replaceAll("\\.\\d+", ""), entity.getTypeInformation());
public TypeInformation<T> getTypeInformation() { return delegate.getTypeInformation(); }