mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-05 10:12:33 +00:00
Replace ClassTypeInformation usages with TypeInformation.
Original Pull Request #2235 Closes #2234
This commit is contained in:
parent
47c0e186ec
commit
12b332223f
@ -26,7 +26,6 @@ import org.springframework.data.convert.TypeInformationMapper;
|
|||||||
import org.springframework.data.mapping.Alias;
|
import org.springframework.data.mapping.Alias;
|
||||||
import org.springframework.data.mapping.PersistentEntity;
|
import org.springframework.data.mapping.PersistentEntity;
|
||||||
import org.springframework.data.mapping.context.MappingContext;
|
import org.springframework.data.mapping.context.MappingContext;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ public class DefaultElasticsearchTypeMapper extends DefaultTypeMapper<Map<String
|
|||||||
implements ElasticsearchTypeMapper {
|
implements ElasticsearchTypeMapper {
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes") //
|
@SuppressWarnings("rawtypes") //
|
||||||
private static final TypeInformation<Map> MAP_TYPE_INFO = ClassTypeInformation.from(Map.class);
|
private static final TypeInformation<Map> MAP_TYPE_INFO = TypeInformation.of(Map.class);
|
||||||
|
|
||||||
private final @Nullable String typeKey;
|
private final @Nullable String typeKey;
|
||||||
|
|
||||||
|
@ -53,8 +53,16 @@ import org.springframework.data.mapping.Parameter;
|
|||||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||||
import org.springframework.data.mapping.SimplePropertyHandler;
|
import org.springframework.data.mapping.SimplePropertyHandler;
|
||||||
import org.springframework.data.mapping.context.MappingContext;
|
import org.springframework.data.mapping.context.MappingContext;
|
||||||
import org.springframework.data.mapping.model.*;
|
import org.springframework.data.mapping.model.ConvertingPropertyAccessor;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
import org.springframework.data.mapping.model.DefaultSpELExpressionEvaluator;
|
||||||
|
import org.springframework.data.mapping.model.EntityInstantiator;
|
||||||
|
import org.springframework.data.mapping.model.EntityInstantiators;
|
||||||
|
import org.springframework.data.mapping.model.ParameterValueProvider;
|
||||||
|
import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider;
|
||||||
|
import org.springframework.data.mapping.model.PropertyValueProvider;
|
||||||
|
import org.springframework.data.mapping.model.SpELContext;
|
||||||
|
import org.springframework.data.mapping.model.SpELExpressionEvaluator;
|
||||||
|
import org.springframework.data.mapping.model.SpELExpressionParameterValueProvider;
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.format.datetime.DateFormatterRegistrar;
|
import org.springframework.format.datetime.DateFormatterRegistrar;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
@ -213,7 +221,7 @@ public class MappingElasticsearchConverter
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
<R> R read(Class<R> type, Document source) {
|
<R> R read(Class<R> type, Document source) {
|
||||||
|
|
||||||
TypeInformation<R> typeHint = ClassTypeInformation.from((Class<R>) ClassUtils.getUserClass(type));
|
TypeInformation<R> typeHint = TypeInformation.of((Class<R>) ClassUtils.getUserClass(type));
|
||||||
R r = read(typeHint, source);
|
R r = read(typeHint, source);
|
||||||
|
|
||||||
if (r == null) {
|
if (r == null) {
|
||||||
@ -244,7 +252,7 @@ public class MappingElasticsearchConverter
|
|||||||
return readMap(typeToUse, source);
|
return readMap(typeToUse, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeToUse.equals(ClassTypeInformation.OBJECT)) {
|
if (typeToUse.equals(TypeInformation.OBJECT)) {
|
||||||
return (R) source;
|
return (R) source;
|
||||||
}
|
}
|
||||||
// Retrieve persistent entity info
|
// Retrieve persistent entity info
|
||||||
@ -286,13 +294,13 @@ public class MappingElasticsearchConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
TypeInformation<?> defaultedValueType = valueType != null ? valueType : ClassTypeInformation.OBJECT;
|
TypeInformation<?> defaultedValueType = valueType != null ? valueType : TypeInformation.OBJECT;
|
||||||
|
|
||||||
if (value instanceof Map) {
|
if (value instanceof Map) {
|
||||||
map.put(key, read(defaultedValueType, (Map<String, Object>) value));
|
map.put(key, read(defaultedValueType, (Map<String, Object>) value));
|
||||||
} else if (value instanceof List) {
|
} else if (value instanceof List) {
|
||||||
map.put(key,
|
map.put(key,
|
||||||
readCollectionOrArray(valueType != null ? valueType : ClassTypeInformation.LIST, (List<Object>) value));
|
readCollectionOrArray(valueType != null ? valueType : TypeInformation.LIST, (List<Object>) value));
|
||||||
} else {
|
} else {
|
||||||
map.put(key, getPotentiallyConvertedSimpleRead(value, rawValueType));
|
map.put(key, getPotentiallyConvertedSimpleRead(value, rawValueType));
|
||||||
}
|
}
|
||||||
@ -397,7 +405,7 @@ public class MappingElasticsearchConverter
|
|||||||
|
|
||||||
for (ElasticsearchPersistentProperty prop : entity) {
|
for (ElasticsearchPersistentProperty prop : entity) {
|
||||||
|
|
||||||
if (entity.isConstructorArgument(prop) || !prop.isReadable()) {
|
if (entity.isCreatorArgument(prop) || !prop.isReadable()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +512,7 @@ public class MappingElasticsearchConverter
|
|||||||
|
|
||||||
TypeInformation<?> componentType = targetType.getComponentType() != null //
|
TypeInformation<?> componentType = targetType.getComponentType() != null //
|
||||||
? targetType.getComponentType() //
|
? targetType.getComponentType() //
|
||||||
: ClassTypeInformation.OBJECT;
|
: TypeInformation.OBJECT;
|
||||||
Class<?> rawComponentType = componentType.getType();
|
Class<?> rawComponentType = componentType.getType();
|
||||||
|
|
||||||
Collection<Object> items = targetType.getType().isArray() //
|
Collection<Object> items = targetType.getType().isArray() //
|
||||||
@ -649,7 +657,8 @@ public class MappingElasticsearchConverter
|
|||||||
* @see org.springframework.data.mapping.model.SpELExpressionParameterValueProvider#potentiallyConvertSpelValue(java.lang.Object, org.springframework.data.mapping.PreferredConstructor.Parameter)
|
* @see org.springframework.data.mapping.model.SpELExpressionParameterValueProvider#potentiallyConvertSpelValue(java.lang.Object, org.springframework.data.mapping.PreferredConstructor.Parameter)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected <T> T potentiallyConvertSpelValue(Object object, Parameter<T, ElasticsearchPersistentProperty> parameter) {
|
protected <T> T potentiallyConvertSpelValue(Object object,
|
||||||
|
Parameter<T, ElasticsearchPersistentProperty> parameter) {
|
||||||
return readValue(object, parameter.getType());
|
return readValue(object, parameter.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,7 +703,7 @@ public class MappingElasticsearchConverter
|
|||||||
writeTypeHints = entity.writeTypeHints();
|
writeTypeHints = entity.writeTypeHints();
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeInformation<?> typeInformation = ClassTypeInformation.from(entityType);
|
TypeInformation<?> typeInformation = TypeInformation.of(entityType);
|
||||||
|
|
||||||
if (writeTypeHints && requiresTypeHint(entityType)) {
|
if (writeTypeHints && requiresTypeHint(entityType)) {
|
||||||
typeMapper.writeType(typeInformation, sink);
|
typeMapper.writeType(typeInformation, sink);
|
||||||
@ -707,7 +716,7 @@ public class MappingElasticsearchConverter
|
|||||||
* Internal write conversion method which should be used for nested invocations.
|
* Internal write conversion method which should be used for nested invocations.
|
||||||
*
|
*
|
||||||
* @param source the object to write
|
* @param source the object to write
|
||||||
* @param sink the write destination
|
* @param sink the destination
|
||||||
* @param typeInformation type information for the source
|
* @param typeInformation type information for the source
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -731,12 +740,12 @@ public class MappingElasticsearchConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Map.class.isAssignableFrom(entityType)) {
|
if (Map.class.isAssignableFrom(entityType)) {
|
||||||
writeMapInternal((Map<Object, Object>) source, sink, ClassTypeInformation.MAP);
|
writeMapInternal((Map<Object, Object>) source, sink, TypeInformation.MAP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Collection.class.isAssignableFrom(entityType)) {
|
if (Collection.class.isAssignableFrom(entityType)) {
|
||||||
writeCollectionInternal((Collection<?>) source, ClassTypeInformation.LIST, (Collection<?>) sink);
|
writeCollectionInternal((Collection<?>) source, TypeInformation.LIST, (Collection<?>) sink);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +758,7 @@ public class MappingElasticsearchConverter
|
|||||||
* Internal write conversion method which should be used for nested invocations.
|
* Internal write conversion method which should be used for nested invocations.
|
||||||
*
|
*
|
||||||
* @param source the object to write
|
* @param source the object to write
|
||||||
* @param sink the write destination
|
* @param sink the destination
|
||||||
* @param entity entity for the source
|
* @param entity entity for the source
|
||||||
*/
|
*/
|
||||||
private void writeInternal(@Nullable Object source, Map<String, Object> sink,
|
private void writeInternal(@Nullable Object source, Map<String, Object> sink,
|
||||||
@ -813,7 +822,7 @@ public class MappingElasticsearchConverter
|
|||||||
} else {
|
} else {
|
||||||
Map<String, Object> document = Document.create();
|
Map<String, Object> document = Document.create();
|
||||||
TypeInformation<?> valueTypeInfo = propertyType.isMap() ? propertyType.getMapValueType()
|
TypeInformation<?> valueTypeInfo = propertyType.isMap() ? propertyType.getMapValueType()
|
||||||
: ClassTypeInformation.OBJECT;
|
: TypeInformation.OBJECT;
|
||||||
writeInternal(value, document, valueTypeInfo);
|
writeInternal(value, document, valueTypeInfo);
|
||||||
|
|
||||||
sink.put(simpleKey, document);
|
sink.put(simpleKey, document);
|
||||||
@ -923,7 +932,7 @@ public class MappingElasticsearchConverter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeInformation<?> valueType = ClassTypeInformation.from(value.getClass());
|
TypeInformation<?> valueType = TypeInformation.of(value.getClass());
|
||||||
TypeInformation<?> type = property.getTypeInformation();
|
TypeInformation<?> type = property.getTypeInformation();
|
||||||
|
|
||||||
if (valueType.isCollectionLike()) {
|
if (valueType.isCollectionLike()) {
|
||||||
@ -955,7 +964,7 @@ public class MappingElasticsearchConverter
|
|||||||
Map<String, Object> document = existingValue instanceof Map ? (Map<String, Object>) existingValue
|
Map<String, Object> document = existingValue instanceof Map ? (Map<String, Object>) existingValue
|
||||||
: Document.create();
|
: Document.create();
|
||||||
|
|
||||||
addCustomTypeKeyIfNecessary(value, document, ClassTypeInformation.from(property.getRawType()));
|
addCustomTypeKeyIfNecessary(value, document, TypeInformation.of(property.getRawType()));
|
||||||
writeInternal(value, document, entity);
|
writeInternal(value, document, entity);
|
||||||
sink.set(property, document);
|
sink.set(property, document);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ import org.springframework.data.mapping.context.MappingContext;
|
|||||||
import org.springframework.data.projection.ProjectionFactory;
|
import org.springframework.data.projection.ProjectionFactory;
|
||||||
import org.springframework.data.repository.core.RepositoryMetadata;
|
import org.springframework.data.repository.core.RepositoryMetadata;
|
||||||
import org.springframework.data.repository.query.QueryMethod;
|
import org.springframework.data.repository.query.QueryMethod;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.Lazy;
|
import org.springframework.data.util.Lazy;
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
@ -78,7 +77,7 @@ public class ElasticsearchQueryMethod extends QueryMethod {
|
|||||||
protected void verifyCountQueryTypes() {
|
protected void verifyCountQueryTypes() {
|
||||||
|
|
||||||
if (hasCountQueryAnnotation()) {
|
if (hasCountQueryAnnotation()) {
|
||||||
TypeInformation<?> returnType = ClassTypeInformation.fromReturnTypeOf(method);
|
TypeInformation<?> returnType = TypeInformation.fromReturnTypeOf(method);
|
||||||
|
|
||||||
if (returnType.getType() != long.class && !Long.class.isAssignableFrom(returnType.getType())) {
|
if (returnType.getType() != long.class && !Long.class.isAssignableFrom(returnType.getType())) {
|
||||||
throw new InvalidDataAccessApiUsageException("count query methods must return a Long");
|
throw new InvalidDataAccessApiUsageException("count query methods must return a Long");
|
||||||
|
@ -37,7 +37,6 @@ import org.springframework.data.projection.ProjectionFactory;
|
|||||||
import org.springframework.data.repository.core.RepositoryMetadata;
|
import org.springframework.data.repository.core.RepositoryMetadata;
|
||||||
import org.springframework.data.repository.util.ReactiveWrapperConverters;
|
import org.springframework.data.repository.util.ReactiveWrapperConverters;
|
||||||
import org.springframework.data.repository.util.ReactiveWrappers;
|
import org.springframework.data.repository.util.ReactiveWrappers;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.Lazy;
|
import org.springframework.data.util.Lazy;
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
@ -49,8 +48,8 @@ import org.springframework.util.ClassUtils;
|
|||||||
*/
|
*/
|
||||||
public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
|
public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
|
||||||
|
|
||||||
private static final ClassTypeInformation<Page> PAGE_TYPE = ClassTypeInformation.from(Page.class);
|
private static final TypeInformation<Page> PAGE_TYPE = TypeInformation.of(Page.class);
|
||||||
private static final ClassTypeInformation<Slice> SLICE_TYPE = ClassTypeInformation.from(Slice.class);
|
private static final TypeInformation<Slice> SLICE_TYPE = TypeInformation.of(Slice.class);
|
||||||
private final Lazy<Boolean> isCollectionQuery;
|
private final Lazy<Boolean> isCollectionQuery;
|
||||||
|
|
||||||
public ReactiveElasticsearchQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
|
public ReactiveElasticsearchQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
|
||||||
@ -60,7 +59,7 @@ public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
|
|||||||
|
|
||||||
if (hasParameterOfType(method, Pageable.class)) {
|
if (hasParameterOfType(method, Pageable.class)) {
|
||||||
|
|
||||||
TypeInformation<?> returnType = ClassTypeInformation.fromReturnTypeOf(method);
|
TypeInformation<?> returnType = TypeInformation.fromReturnTypeOf(method);
|
||||||
boolean multiWrapper = ReactiveWrappers.isMultiValueType(returnType.getType());
|
boolean multiWrapper = ReactiveWrappers.isMultiValueType(returnType.getType());
|
||||||
boolean singleWrapperWithWrappedPageableResult = ReactiveWrappers.isSingleValueType(returnType.getType())
|
boolean singleWrapperWithWrappedPageableResult = ReactiveWrappers.isSingleValueType(returnType.getType())
|
||||||
&& (PAGE_TYPE.isAssignableFrom(returnType.getRequiredComponentType())
|
&& (PAGE_TYPE.isAssignableFrom(returnType.getRequiredComponentType())
|
||||||
@ -75,12 +74,12 @@ public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
|
|||||||
if (!multiWrapper) {
|
if (!multiWrapper) {
|
||||||
throw new IllegalStateException(String.format(
|
throw new IllegalStateException(String.format(
|
||||||
"Method has to use a either multi-item reactive wrapper return type or a wrapped Page/Slice type. Offending method: %s",
|
"Method has to use a either multi-item reactive wrapper return type or a wrapped Page/Slice type. Offending method: %s",
|
||||||
method.toString()));
|
method));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasParameterOfType(method, Sort.class)) {
|
if (hasParameterOfType(method, Sort.class)) {
|
||||||
throw new IllegalStateException(String.format("Method must not have Pageable *and* Sort parameter. "
|
throw new IllegalStateException(String.format("Method must not have Pageable *and* Sort parameter. "
|
||||||
+ "Use sorting capabilities on Pageble instead! Offending method: %s", method.toString()));
|
+ "Use sorting capabilities on Pageble instead! Offending method: %s", method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ public class ReactiveElasticsearchQueryMethod extends ElasticsearchQueryMethod {
|
|||||||
@Override
|
@Override
|
||||||
protected void verifyCountQueryTypes() {
|
protected void verifyCountQueryTypes() {
|
||||||
if (hasCountQueryAnnotation()) {
|
if (hasCountQueryAnnotation()) {
|
||||||
TypeInformation<?> returnType = ClassTypeInformation.fromReturnTypeOf(method);
|
TypeInformation<?> returnType = TypeInformation.fromReturnTypeOf(method);
|
||||||
List<TypeInformation<?>> typeArguments = returnType.getTypeArguments();
|
List<TypeInformation<?>> typeArguments = returnType.getTypeArguments();
|
||||||
|
|
||||||
if (!Mono.class.isAssignableFrom(returnType.getType()) || typeArguments.size() != 1
|
if (!Mono.class.isAssignableFrom(returnType.getType()) || typeArguments.size() != 1
|
||||||
|
@ -37,7 +37,6 @@ import org.springframework.data.mapping.model.FieldNamingStrategy;
|
|||||||
import org.springframework.data.mapping.model.Property;
|
import org.springframework.data.mapping.model.Property;
|
||||||
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
||||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
|
||||||
import org.springframework.data.util.TypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
@ -62,8 +61,8 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
@Test
|
@Test
|
||||||
public void shouldThrowExceptionGivenVersionPropertyIsNotLong() {
|
public void shouldThrowExceptionGivenVersionPropertyIsNotLong() {
|
||||||
|
|
||||||
TypeInformation<EntityWithWrongVersionType> typeInformation = ClassTypeInformation
|
TypeInformation<EntityWithWrongVersionType> typeInformation = TypeInformation
|
||||||
.from(EntityWithWrongVersionType.class);
|
.of(EntityWithWrongVersionType.class);
|
||||||
SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType> entity = new SimpleElasticsearchPersistentEntity<>(
|
SimpleElasticsearchPersistentEntity<EntityWithWrongVersionType> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
typeInformation, contextConfiguration);
|
typeInformation, contextConfiguration);
|
||||||
|
|
||||||
@ -73,8 +72,8 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
@Test
|
@Test
|
||||||
public void shouldThrowExceptionGivenMultipleVersionPropertiesArePresent() {
|
public void shouldThrowExceptionGivenMultipleVersionPropertiesArePresent() {
|
||||||
|
|
||||||
TypeInformation<EntityWithMultipleVersionField> typeInformation = ClassTypeInformation
|
TypeInformation<EntityWithMultipleVersionField> typeInformation = TypeInformation
|
||||||
.from(EntityWithMultipleVersionField.class);
|
.of(EntityWithMultipleVersionField.class);
|
||||||
SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField> entity = new SimpleElasticsearchPersistentEntity<>(
|
SimpleElasticsearchPersistentEntity<EntityWithMultipleVersionField> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
typeInformation, contextConfiguration);
|
typeInformation, contextConfiguration);
|
||||||
SimpleElasticsearchPersistentProperty persistentProperty1 = createProperty(entity, "version1");
|
SimpleElasticsearchPersistentProperty persistentProperty1 = createProperty(entity, "version1");
|
||||||
@ -102,8 +101,8 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
@Test
|
@Test
|
||||||
// DATAES-799
|
// DATAES-799
|
||||||
void shouldReportThatThereIsNoSeqNoPrimaryTermPropertyWhenThereIsNoSuchProperty() {
|
void shouldReportThatThereIsNoSeqNoPrimaryTermPropertyWhenThereIsNoSuchProperty() {
|
||||||
TypeInformation<EntityWithoutSeqNoPrimaryTerm> typeInformation = ClassTypeInformation
|
TypeInformation<EntityWithoutSeqNoPrimaryTerm> typeInformation = TypeInformation
|
||||||
.from(EntityWithoutSeqNoPrimaryTerm.class);
|
.of(EntityWithoutSeqNoPrimaryTerm.class);
|
||||||
SimpleElasticsearchPersistentEntity<EntityWithoutSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
SimpleElasticsearchPersistentEntity<EntityWithoutSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
typeInformation, contextConfiguration);
|
typeInformation, contextConfiguration);
|
||||||
|
|
||||||
@ -113,8 +112,8 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
@Test
|
@Test
|
||||||
// DATAES-799
|
// DATAES-799
|
||||||
void shouldReportThatThereIsSeqNoPrimaryTermPropertyWhenThereIsSuchProperty() {
|
void shouldReportThatThereIsSeqNoPrimaryTermPropertyWhenThereIsSuchProperty() {
|
||||||
TypeInformation<EntityWithSeqNoPrimaryTerm> typeInformation = ClassTypeInformation
|
TypeInformation<EntityWithSeqNoPrimaryTerm> typeInformation = TypeInformation
|
||||||
.from(EntityWithSeqNoPrimaryTerm.class);
|
.of(EntityWithSeqNoPrimaryTerm.class);
|
||||||
SimpleElasticsearchPersistentEntity<EntityWithSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
SimpleElasticsearchPersistentEntity<EntityWithSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
typeInformation, contextConfiguration);
|
typeInformation, contextConfiguration);
|
||||||
|
|
||||||
@ -127,8 +126,8 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
// DATAES-799
|
// DATAES-799
|
||||||
void shouldReturnSeqNoPrimaryTermPropertyWhenThereIsSuchProperty() {
|
void shouldReturnSeqNoPrimaryTermPropertyWhenThereIsSuchProperty() {
|
||||||
|
|
||||||
TypeInformation<EntityWithSeqNoPrimaryTerm> typeInformation = ClassTypeInformation
|
TypeInformation<EntityWithSeqNoPrimaryTerm> typeInformation = TypeInformation
|
||||||
.from(EntityWithSeqNoPrimaryTerm.class);
|
.of(EntityWithSeqNoPrimaryTerm.class);
|
||||||
SimpleElasticsearchPersistentEntity<EntityWithSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
SimpleElasticsearchPersistentEntity<EntityWithSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
typeInformation, contextConfiguration);
|
typeInformation, contextConfiguration);
|
||||||
entity.addPersistentProperty(createProperty(entity, "seqNoPrimaryTerm"));
|
entity.addPersistentProperty(createProperty(entity, "seqNoPrimaryTerm"));
|
||||||
@ -146,8 +145,8 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
@Test
|
@Test
|
||||||
// DATAES-799
|
// DATAES-799
|
||||||
void shouldNotAllowMoreThanOneSeqNoPrimaryTermProperties() {
|
void shouldNotAllowMoreThanOneSeqNoPrimaryTermProperties() {
|
||||||
TypeInformation<EntityWithSeqNoPrimaryTerm> typeInformation = ClassTypeInformation
|
TypeInformation<EntityWithSeqNoPrimaryTerm> typeInformation = TypeInformation
|
||||||
.from(EntityWithSeqNoPrimaryTerm.class);
|
.of(EntityWithSeqNoPrimaryTerm.class);
|
||||||
SimpleElasticsearchPersistentEntity<EntityWithSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
SimpleElasticsearchPersistentEntity<EntityWithSeqNoPrimaryTerm> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
typeInformation, contextConfiguration);
|
typeInformation, contextConfiguration);
|
||||||
entity.addPersistentProperty(createProperty(entity, "seqNoPrimaryTerm"));
|
entity.addPersistentProperty(createProperty(entity, "seqNoPrimaryTerm"));
|
||||||
@ -199,7 +198,7 @@ public class SimpleElasticsearchPersistentEntityTests extends MappingContextBase
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} """;
|
}""";
|
||||||
|
|
||||||
ElasticsearchPersistentEntity<?> entity = elasticsearchConverter.get().getMappingContext()
|
ElasticsearchPersistentEntity<?> entity = elasticsearchConverter.get().getMappingContext()
|
||||||
.getRequiredPersistentEntity(SettingsValidSortParameterSizes.class);
|
.getRequiredPersistentEntity(SettingsValidSortParameterSizes.class);
|
||||||
|
@ -41,7 +41,7 @@ import org.springframework.data.mapping.model.Property;
|
|||||||
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
import org.springframework.data.mapping.model.PropertyNameFieldNamingStrategy;
|
||||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||||
import org.springframework.data.mapping.model.SnakeCaseFieldNamingStrategy;
|
import org.springframework.data.mapping.model.SnakeCaseFieldNamingStrategy;
|
||||||
import org.springframework.data.util.ClassTypeInformation;
|
import org.springframework.data.util.TypeInformation;
|
||||||
import org.springframework.lang.Nullable;
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.ReflectionUtils;
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
|
||||||
@ -207,8 +207,8 @@ public class SimpleElasticsearchPersistentPropertyUnitTests {
|
|||||||
PropertyNameFieldNamingStrategy.INSTANCE, true);
|
PropertyNameFieldNamingStrategy.INSTANCE, true);
|
||||||
|
|
||||||
ElasticsearchPersistentEntity<FieldNamingStrategyEntity> entity = new SimpleElasticsearchPersistentEntity<>(
|
ElasticsearchPersistentEntity<FieldNamingStrategyEntity> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
ClassTypeInformation.from(FieldNamingStrategyEntity.class), contextConfiguration);
|
TypeInformation.of(FieldNamingStrategyEntity.class), contextConfiguration);
|
||||||
ClassTypeInformation<FieldNamingStrategyEntity> type = ClassTypeInformation.from(FieldNamingStrategyEntity.class);
|
TypeInformation<FieldNamingStrategyEntity> type = TypeInformation.of(FieldNamingStrategyEntity.class);
|
||||||
|
|
||||||
java.lang.reflect.Field field = ReflectionUtils.findField(FieldNamingStrategyEntity.class,
|
java.lang.reflect.Field field = ReflectionUtils.findField(FieldNamingStrategyEntity.class,
|
||||||
"withoutCustomFieldName");
|
"withoutCustomFieldName");
|
||||||
@ -232,8 +232,8 @@ public class SimpleElasticsearchPersistentPropertyUnitTests {
|
|||||||
fieldNamingStrategy, true);
|
fieldNamingStrategy, true);
|
||||||
|
|
||||||
ElasticsearchPersistentEntity<FieldNamingStrategyEntity> entity = new SimpleElasticsearchPersistentEntity<>(
|
ElasticsearchPersistentEntity<FieldNamingStrategyEntity> entity = new SimpleElasticsearchPersistentEntity<>(
|
||||||
ClassTypeInformation.from(FieldNamingStrategyEntity.class), contextConfiguration);
|
TypeInformation.of(FieldNamingStrategyEntity.class), contextConfiguration);
|
||||||
ClassTypeInformation<FieldNamingStrategyEntity> type = ClassTypeInformation.from(FieldNamingStrategyEntity.class);
|
TypeInformation<FieldNamingStrategyEntity> type = TypeInformation.of(FieldNamingStrategyEntity.class);
|
||||||
|
|
||||||
java.lang.reflect.Field field = ReflectionUtils.findField(FieldNamingStrategyEntity.class,
|
java.lang.reflect.Field field = ReflectionUtils.findField(FieldNamingStrategyEntity.class,
|
||||||
"withoutCustomFieldName");
|
"withoutCustomFieldName");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user