|
16 | 16 | package org.springframework.data.cassandra.core; |
17 | 17 |
|
18 | 18 | import org.jspecify.annotations.Nullable; |
| 19 | + |
19 | 20 | import org.springframework.core.convert.ConversionService; |
20 | 21 | import org.springframework.data.cassandra.core.convert.CassandraConverter; |
21 | 22 | import org.springframework.data.cassandra.core.cql.util.StatementBuilder; |
22 | 23 | import org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity; |
23 | 24 | import org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty; |
24 | | -import org.springframework.data.convert.CustomConversions; |
25 | 25 | import org.springframework.data.mapping.PersistentPropertyAccessor; |
26 | 26 | import org.springframework.data.mapping.context.MappingContext; |
27 | 27 | import org.springframework.data.mapping.model.ConvertingPropertyAccessor; |
28 | | -import org.springframework.data.projection.EntityProjection; |
29 | | -import org.springframework.data.projection.EntityProjectionIntrospector; |
30 | | -import org.springframework.data.projection.ProjectionFactory; |
31 | 28 | import org.springframework.util.Assert; |
32 | | -import org.springframework.util.ClassUtils; |
33 | 29 |
|
34 | 30 | import com.datastax.oss.driver.api.core.CqlIdentifier; |
35 | 31 | import com.datastax.oss.driver.api.querybuilder.condition.Condition; |
|
49 | 45 | class EntityOperations { |
50 | 46 |
|
51 | 47 | private final MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> mappingContext; |
52 | | - private final EntityProjectionIntrospector introspector; |
53 | 48 |
|
54 | 49 | EntityOperations(CassandraConverter converter) { |
55 | | - this(converter.getMappingContext(), converter.getCustomConversions(), converter.getProjectionFactory()); |
56 | | - } |
57 | | - |
58 | | - EntityOperations(MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> context, |
59 | | - CustomConversions conversions, ProjectionFactory projectionFactory) { |
60 | | - this.mappingContext = context; |
61 | | - this.introspector = EntityProjectionIntrospector.create(projectionFactory, |
62 | | - EntityProjectionIntrospector.ProjectionPredicate.typeHierarchy() |
63 | | - .and(((target, underlyingType) -> !conversions.isSimpleType(target))), |
64 | | - context); |
| 50 | + this.mappingContext = converter.getMappingContext(); |
65 | 51 | } |
66 | 52 |
|
67 | 53 | /** |
@@ -92,41 +78,6 @@ public <T> AdaptibleEntity<T> forEntity(T entity, ConversionService conversionSe |
92 | 78 | return AdaptibleMappedEntity.of(entity, getMappingContext(), conversionService); |
93 | 79 | } |
94 | 80 |
|
95 | | - /** |
96 | | - * Returns the {@link MappingContext} used by this entity data access operations class to access mapping meta-data |
97 | | - * used to store (map) object to Cassandra tables. |
98 | | - * |
99 | | - * @return the {@link MappingContext} used by this entity data access operations class. |
100 | | - * @see org.springframework.data.cassandra.core.mapping.CassandraMappingContext |
101 | | - */ |
102 | | - CassandraPersistentEntity<?> getRequiredPersistentEntity(Class<?> entityClass) { |
103 | | - return getMappingContext().getRequiredPersistentEntity(ClassUtils.getUserClass(entityClass)); |
104 | | - } |
105 | | - |
106 | | - /** |
107 | | - * Returns the table name to which the entity shall be persisted. |
108 | | - * |
109 | | - * @param entityClass entity class, must not be {@literal null}. |
110 | | - * @return the table name to which the entity shall be persisted. |
111 | | - */ |
112 | | - CqlIdentifier getTableName(Class<?> entityClass) { |
113 | | - return getRequiredPersistentEntity(entityClass).getTableName(); |
114 | | - } |
115 | | - |
116 | | - /** |
117 | | - * Introspect the given {@link Class result type} in the context of the {@link Class entity type} whether the returned |
118 | | - * type is a projection and what property paths are participating in the projection. |
119 | | - * |
120 | | - * @param resultType the type to project on. Must not be {@literal null}. |
121 | | - * @param entityType the source domain type. Must not be {@literal null}. |
122 | | - * @return the introspection result. |
123 | | - * @since 3.4 |
124 | | - * @see EntityProjectionIntrospector#introspect(Class, Class) |
125 | | - */ |
126 | | - public <M, D> EntityProjection<M, D> introspectProjection(Class<M> resultType, Class<D> entityType) { |
127 | | - return introspector.introspect(resultType, entityType); |
128 | | - } |
129 | | - |
130 | 81 | protected MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> getMappingContext() { |
131 | 82 | return this.mappingContext; |
132 | 83 | } |
|
0 commit comments