Skip to content

Commit

Permalink
Adopt to deprecation removals in Commons.
Browse files Browse the repository at this point in the history
Closes #1540
  • Loading branch information
mp911de committed Jan 14, 2025
1 parent 3ac3bfd commit 1dac7aa
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 313 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private <R> R doReadProjection(ConversionContext context, CassandraValueProvider
if (mappedEntity.requiresPropertyPopulation()) {

PersistentPropertyAccessor<R> accessor = mappedEntity.getPropertyAccessor(instance);
readProperties(context, mappedEntity, valueProviderToUse, accessor, isConstructorArgument(mappedEntity).negate());
readProperties(context, mappedEntity, valueProviderToUse, accessor, isCreatorArgument(mappedEntity).negate());
return accessor.getBean();
}

Expand Down Expand Up @@ -590,7 +590,7 @@ private <S> S populateProperties(ConversionContext context, CassandraPersistentE
}

ConvertingPropertyAccessor<S> propertyAccessor = newConvertingPropertyAccessor(instance, entity);
readProperties(context, entity, valueProvider, propertyAccessor, isConstructorArgument(entity).negate());
readProperties(context, entity, valueProvider, propertyAccessor, isCreatorArgument(entity).negate());
return propertyAccessor.getBean();
}

Expand Down Expand Up @@ -1306,8 +1306,8 @@ private static Class<?> resolveMapType(TypeInformation<?> typeInformation) {
return Map.class.isAssignableFrom(mapType) ? mapType : Map.class;
}

static Predicate<CassandraPersistentProperty> isConstructorArgument(PersistentEntity<?, ?> entity) {
return entity::isConstructorArgument;
static Predicate<CassandraPersistentProperty> isCreatorArgument(PersistentEntity<?, ?> entity) {
return entity::isCreatorArgument;
}

enum NoOpParameterValueProvider implements ParameterValueProvider<CassandraPersistentProperty> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,11 @@ public String getName() {
}

@Override
@org.springframework.lang.Nullable
public PreferredConstructor<T, CassandraPersistentProperty> getPersistenceConstructor() {
return delegate.getPersistenceConstructor();
}

@Override
@Nullable
public InstanceCreatorMetadata<CassandraPersistentProperty> getInstanceCreatorMetadata() {
return delegate.getInstanceCreatorMetadata();
}

@Override
public boolean isConstructorArgument(PersistentProperty<?> property) {
return delegate.isConstructorArgument(property);
}

@Override
public boolean isCreatorArgument(PersistentProperty<?> property) {
return delegate.isCreatorArgument(property);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.springframework.data.repository.query.ParametersSource;
import org.springframework.data.repository.util.QueryExecutionConverters;
import org.springframework.data.repository.util.ReactiveWrapperConverters;
import org.springframework.data.repository.util.ReactiveWrappers;
import org.springframework.data.util.ReactiveWrappers;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

import org.reactivestreams.Publisher;
import org.springframework.data.repository.util.ReactiveWrapperConverters;
import org.springframework.data.repository.util.ReactiveWrappers;
import org.springframework.data.util.ReactiveWrappers;

/**
* Reactive {@link org.springframework.data.repository.query.ParametersParameterAccessor} implementation that subscribes
* to reactive parameter wrapper types upon creation. This class performs synchronization when acessing parameters.
* to reactive parameter wrapper types upon creation. This class performs synchronization when accessing parameters.
*
* @author Mark Paluch
* @since 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import org.springframework.data.projection.ProjectionFactory;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.util.ReactiveWrapperConverters;
import org.springframework.data.repository.util.ReactiveWrappers;
import org.springframework.data.util.Lazy;
import org.springframework.data.util.ReactiveWrappers;

/**
* Reactive specific implementation of {@link CassandraQueryMethod}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,13 @@

import reactor.core.publisher.Mono;

import org.springframework.core.env.StandardEnvironment;
import org.springframework.data.cassandra.core.ReactiveCassandraOperations;
import org.springframework.data.cassandra.repository.Query;
import org.springframework.data.expression.ReactiveValueEvaluationContextProvider;
import org.springframework.data.expression.ValueEvaluationContextProvider;
import org.springframework.data.expression.ValueExpressionParser;
import org.springframework.data.mapping.model.ValueExpressionEvaluator;
import org.springframework.data.repository.query.QueryMethodEvaluationContextProvider;
import org.springframework.data.repository.query.QueryMethodValueEvaluationContextAccessor;
import org.springframework.data.repository.query.ReactiveQueryMethodEvaluationContextProvider;
import org.springframework.data.repository.query.ValueExpressionDelegate;
import org.springframework.data.spel.ExpressionDependencies;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.util.Assert;

Expand Down Expand Up @@ -62,50 +56,6 @@ public class ReactiveStringBasedCassandraQuery extends AbstractReactiveCassandra

private final ReactiveValueEvaluationContextProvider valueEvaluationContextProvider;

/**
* Create a new {@link ReactiveStringBasedCassandraQuery} for the given {@link CassandraQueryMethod},
* {@link ReactiveCassandraOperations}, {@link SpelExpressionParser}, and
* {@link QueryMethodEvaluationContextProvider}.
*
* @param queryMethod {@link ReactiveCassandraQueryMethod} on which this query is based.
* @param operations {@link ReactiveCassandraOperations} used to perform data access in Cassandra.
* @param expressionParser {@link SpelExpressionParser} used to parse expressions in the query.
* @param evaluationContextProvider {@link QueryMethodEvaluationContextProvider} used to access the potentially shared
* {@link org.springframework.expression.spel.support.StandardEvaluationContext}.
* @see org.springframework.data.cassandra.repository.query.ReactiveCassandraQueryMethod
* @see org.springframework.data.cassandra.core.ReactiveCassandraOperations
* @deprecated since 4.4, use the constructors accepting {@link ValueExpressionDelegate} instead.
*/
@Deprecated(since = "4.4")
public ReactiveStringBasedCassandraQuery(ReactiveCassandraQueryMethod queryMethod,
ReactiveCassandraOperations operations, ExpressionParser expressionParser,
ReactiveQueryMethodEvaluationContextProvider evaluationContextProvider) {

this(queryMethod.getRequiredAnnotatedQuery(), queryMethod, operations, expressionParser, evaluationContextProvider);
}

/**
* Create a new {@link ReactiveStringBasedCassandraQuery} for the given {@code query}, {@link CassandraQueryMethod},
* {@link ReactiveCassandraOperations}, {@link SpelExpressionParser}, and
* {@link QueryMethodEvaluationContextProvider}.
*
* @param method {@link ReactiveCassandraQueryMethod} on which this query is based.
* @param operations {@link ReactiveCassandraOperations} used to perform data access in Cassandra.
* @param expressionParser {@link SpelExpressionParser} used to parse expressions in the query.
* @param evaluationContextProvider {@link QueryMethodEvaluationContextProvider} used to access the potentially shared
* {@link org.springframework.expression.spel.support.StandardEvaluationContext}.
* @see org.springframework.data.cassandra.repository.query.ReactiveCassandraQueryMethod
* @see org.springframework.data.cassandra.core.ReactiveCassandraOperations
* @deprecated since 4.4, use the constructors accepting {@link ValueExpressionDelegate} instead.
*/
@Deprecated(since = "4.4")
public ReactiveStringBasedCassandraQuery(String query, ReactiveCassandraQueryMethod method,
ReactiveCassandraOperations operations, ExpressionParser expressionParser,
ReactiveQueryMethodEvaluationContextProvider evaluationContextProvider) {

this(query, method, operations, new ValueExpressionDelegate(new QueryMethodValueEvaluationContextAccessor(new StandardEnvironment(), evaluationContextProvider.getEvaluationContextProvider()), ValueExpressionParser.create(() -> expressionParser)));
}

/**
* Create a new {@link ReactiveStringBasedCassandraQuery} for the given {@link CassandraQueryMethod},
* {@link ReactiveCassandraOperations}, {@link ValueExpressionDelegate}
Expand Down Expand Up @@ -145,9 +95,9 @@ public ReactiveStringBasedCassandraQuery(String query, ReactiveCassandraQueryMet

this.stringBasedQuery = new StringBasedQuery(query, method.getParameters(), delegate);

ValueEvaluationContextProvider valueContextProvider = delegate.createValueContextProvider(
method.getParameters());
Assert.isInstanceOf(ReactiveValueEvaluationContextProvider.class, valueContextProvider, "ValueEvaluationContextProvider must be reactive");
ValueEvaluationContextProvider valueContextProvider = delegate.createValueContextProvider(method.getParameters());
Assert.isInstanceOf(ReactiveValueEvaluationContextProvider.class, valueContextProvider,
"ValueEvaluationContextProvider must be reactive");
this.valueEvaluationContextProvider = (ReactiveValueEvaluationContextProvider) valueContextProvider;

if (method.hasAnnotatedQuery()) {
Expand Down
Loading

0 comments on commit 1dac7aa

Please sign in to comment.