General removal of deprecated API.

See #2466
This commit is contained in:
Mark Paluch
2021-09-20 13:48:17 +02:00
committed by Jens Schauder
parent aecdf5001a
commit 2618221115
20 changed files with 56 additions and 461 deletions

View File

@@ -19,11 +19,9 @@ import java.util.Optional;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.mapping.context.PersistentEntities;
import org.springframework.util.Assert;
@@ -40,20 +38,6 @@ public class AuditingHandler extends AuditingHandlerSupport implements Initializ
private Optional<AuditorAware<?>> auditorAware;
/**
* Creates a new {@link AuditableBeanWrapper} using the given {@link MappingContext} when looking up auditing metadata
* via reflection.
*
* @param mappingContext must not be {@literal null}.
* @since 1.8
* @deprecated use {@link AuditingHandler(PersistentEntities)} instead.
*/
@Deprecated
public AuditingHandler(
MappingContext<? extends PersistentEntity<?, ?>, ? extends PersistentProperty<?>> mappingContext) {
this(PersistentEntities.of(mappingContext));
}
/**
* Creates a new {@link AuditableBeanWrapper} using the given {@link PersistentEntities} when looking up auditing
* metadata via reflection.

View File

@@ -35,19 +35,6 @@ public class IsNewAwareAuditingHandler extends AuditingHandler {
private final PersistentEntities entities;
/**
* Creates a new {@link IsNewAwareAuditingHandler} for the given {@link MappingContext}.
*
* @param mappingContext must not be {@literal null}.
* @since 1.8
* @deprecated use {@link IsNewAwareAuditingHandler(PersistentEntities)} instead.
*/
@Deprecated
public IsNewAwareAuditingHandler(
MappingContext<? extends PersistentEntity<?, ?>, ? extends PersistentProperty<?>> mappingContext) {
this(PersistentEntities.of(mappingContext));
}
/**
* Creates a new {@link IsNewAwareAuditingHandler} for the given {@link MappingContext}.
*

View File

@@ -64,17 +64,6 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
*/
TypeInformation<?> getTypeInformation();
/**
* Returns the {@link TypeInformation} if the property references a {@link PersistentEntity}. Will return
* {@literal null} in case it refers to a simple type. Will return {@link Collection}'s component type or the
* {@link Map}'s value type transparently.
*
* @return
* @deprecated since 2.6 for removal in 3.0. Use {@link #getPersistentEntityTypeInformation()} instead.
*/
@Deprecated
Iterable<? extends TypeInformation<?>> getPersistentEntityTypes();
/**
* Returns the detected {@link TypeInformation TypeInformations} if the property references a {@link PersistentEntity}.
* Will return an {@literal empty} {@link Iterable} in case it refers to a simple type. Will return the {@link Collection}'s

View File

@@ -158,15 +158,6 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
return information;
}
/*
* (non-Javadoc)
* @see org.springframework.data.mapping.PersistentProperty#getPersistentEntityTypes()
*/
@Override
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypes() {
return getPersistentEntityTypeInformation();
}
/*
* (non-Javadoc)
* @see org.springframework.data.mapping.PersistentProperty#getPersistentEntityTypeInformation()

View File

@@ -46,26 +46,6 @@ public class InstantiationAwarePropertyAccessor<T> implements PersistentProperty
private T bean;
/**
* Creates an {@link InstantiationAwarePropertyAccessor} using the given delegate {@link PersistentPropertyAccessor}
* and {@link EntityInstantiators}.
*
* @param delegate must not be {@literal null}.
* @param instantiators must not be {@literal null}.
* @deprecated since 2.4. Using this constructor allows only setting a single property as
* {@link PersistentPropertyAccessor} holds a reference to the initial bean state.
*/
@Deprecated
public InstantiationAwarePropertyAccessor(PersistentPropertyAccessor<T> delegate, EntityInstantiators instantiators) {
Assert.notNull(delegate, "Delegate PersistentPropertyAccessor must not be null!");
Assert.notNull(instantiators, "EntityInstantiators must not be null!");
this.instantiators = instantiators;
this.delegateFunction = t -> delegate;
this.bean = delegate.getBean();
}
/**
* Creates an {@link InstantiationAwarePropertyAccessor} using the given delegate {@code accessorFunction} and
* {@link EntityInstantiators}. {@code accessorFunction} is used to obtain a new {@link PersistentPropertyAccessor}

View File

@@ -322,16 +322,7 @@ public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapabl
* @param repositoryType will never be {@literal null}.
* @return
*/
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType) {
CdiRepositoryConfiguration cdiRepositoryConfiguration = lookupConfiguration(beanManager, qualifiers);
Optional<Bean<?>> customImplementationBean = getCustomImplementationBean(repositoryType,
cdiRepositoryConfiguration);
Optional<Object> customImplementation = customImplementationBean.map(this::getDependencyInstance);
return create(creationalContext, repositoryType, customImplementation);
}
protected abstract T create(CreationalContext<T> creationalContext, Class<T> repositoryType);
/**
* Creates the actual component instance given a {@link RepositoryFactorySupport repository factory supplier} and the
@@ -417,24 +408,6 @@ public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapabl
Arrays.asList(repositoryType.getInterfaces()))));
}
/**
* Creates the actual component instance.
*
* @param creationalContext will never be {@literal null}.
* @param repositoryType will never be {@literal null}.
* @param customImplementation can be {@literal null}.
* @return
* @deprecated since 2.1, override {@link #create(CreationalContext, Class)} in which you create a repository factory
* and call {@link #create(RepositoryFactorySupport, Class, RepositoryFragments)}.
*/
@Deprecated
protected T create(CreationalContext<T> creationalContext, Class<T> repositoryType,
Optional<Object> customImplementation) {
throw new UnsupportedOperationException(
"You have to implement create(CreationalContext<T>, Class<T>, Optional<Object>) "
+ "in order to use custom repository implementations");
}
/**
* Looks up an instance of a {@link CdiRepositoryConfiguration}. In case the instance cannot be found within the CDI
* scope, a default configuration is used.

View File

@@ -16,7 +16,6 @@
package org.springframework.data.repository.query;
import java.util.Iterator;
import java.util.Optional;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
@@ -46,16 +45,6 @@ public interface ParameterAccessor extends Iterable<Object> {
*/
Sort getSort();
/**
* Returns the dynamic projection type to be used when executing the query or {@literal null} if none is defined.
*
* @return
* @since 1.12
* @deprecated use {@link #findDynamicProjection()} instead.
*/
@Deprecated
Optional<Class<?>> getDynamicProjection();
/**
* Returns the dynamic projection type to be used when executing the query or {@literal null} if none is defined.
*

View File

@@ -16,7 +16,6 @@
package org.springframework.data.repository.query;
import java.util.Iterator;
import java.util.Optional;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
@@ -128,18 +127,6 @@ public class ParametersParameterAccessor implements ParameterAccessor {
return Sort.unsorted();
}
/**
* Returns the dynamic projection type if available, {@literal null} otherwise.
*
* @return
*/
public Optional<Class<?>> getDynamicProjection() {
return Optional.ofNullable(parameters.hasDynamicProjection() //
? (Class<?>) values[parameters.getDynamicProjectionIndex()] //
: null);
}
/**
* Returns the dynamic projection type if available, {@literal null} otherwise.
*

View File

@@ -1,54 +0,0 @@
/*
* Copyright 2016-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository.support;
import java.util.List;
import java.util.function.LongSupplier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* Support for query execution using {@link Pageable}. Using {@link PageableExecutionUtils} assumes that data queries
* are cheaper than {@code COUNT} queries and so some cases can take advantage of optimizations.
*
* @author Mark Paluch
* @author Oliver Gierke
* @author Christoph Strobl
* @author Jens Schauder
* @since 1.13
* @deprecated since 2.4. Use {@link org.springframework.data.support.PageableExecutionUtils} instead
*/
@Deprecated
public abstract class PageableExecutionUtils {
private PageableExecutionUtils() {}
/**
* Constructs a {@link Page} based on the given {@code content}, {@link Pageable} and {@link LongSupplier} applying
* optimizations. The construction of {@link Page} omits a count query if the total can be determined based on the
* result size and {@link Pageable}.
*
* @param content result of a query with applied {@link Pageable}. The list must not be {@literal null} and must
* contain up to {@link Pageable#getPageSize()} items.
* @param pageable must not be {@literal null}.
* @param totalSupplier must not be {@literal null}.
* @return the {@link Page} for {@link List content} and a total size.
*/
public static <T> Page<T> getPage(List<T> content, Pageable pageable, LongSupplier totalSupplier) {
return org.springframework.data.support.PageableExecutionUtils.getPage(content, pageable, totalSupplier);
}
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright 2014-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.repository.util;
import org.springframework.core.convert.converter.Converter;
import org.springframework.lang.Nullable;
/**
* Simple value object to wrap a nullable delegate. Used to be able to write {@link Converter} implementations that
* convert {@literal null} into an object of some sort.
*
* @author Oliver Gierke
* @author Mark Paluch
* @since 1.8
* @see QueryExecutionConverters
* @deprecated since 2.4, use {@link org.springframework.data.util.NullableWrapper} instead.
*/
@Deprecated
public class NullableWrapper extends org.springframework.data.util.NullableWrapper {
/**
* Creates a new {@link NullableWrapper} for the given value.
*
* @param value can be {@literal null}.
*/
public NullableWrapper(@Nullable Object value) {
super(value);
}
}

View File

@@ -19,8 +19,6 @@ import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Optional;
import org.springframework.core.ReactiveAdapter;
@@ -220,39 +218,6 @@ public abstract class ReactiveWrappers {
: findDescriptor(type).map(ReactiveTypeDescriptor::isMultiValue).orElse(false);
}
/**
* Returns a collection of no-value wrapper types.
*
* @return a collection of no-value wrapper types.
* @deprecated not supported anymore.
*/
@Deprecated
public static Collection<Class<?>> getNoValueTypes() {
return Collections.emptyList();
}
/**
* Returns a collection of single-value wrapper types.
*
* @return a collection of single-value wrapper types.
* @deprecated not supported anymore.
*/
@Deprecated
public static Collection<Class<?>> getSingleValueTypes() {
return Collections.emptyList();
}
/**
* Returns a collection of multi-value wrapper types.
*
* @return a collection of multi-value wrapper types.
* @deprecated not supported anymore.
*/
@Deprecated
public static Collection<Class<?>> getMultiValueTypes() {
return Collections.emptyList();
}
/**
* Returns whether the given type is a reactive wrapper type.
*

View File

@@ -46,10 +46,8 @@ public class Lazy<T> implements Supplier<T> {
* Creates a new {@link Lazy} instance for the given supplier.
*
* @param supplier
* @deprecated prefer {@link Lazy#of(Supplier)}, to be turned private in 2.5.
*/
@Deprecated
public Lazy(Supplier<? extends T> supplier) {
private Lazy(Supplier<? extends T> supplier) {
this(supplier, null, false);
}

View File

@@ -386,31 +386,6 @@ public final class ReflectionUtils {
return true;
}
/**
* Return {@literal true} if the specified class is a Kotlin one.
*
* @return {@literal true} if {@code type} is a Kotlin class.
* @since 2.0
* @deprecated since 2.3, use {@link KotlinDetector#isKotlinType(Class)} instead.
*/
@Deprecated
public static boolean isKotlinClass(Class<?> type) {
return KotlinDetector.isKotlinType(type);
}
/**
* Return {@literal true} if the specified class is a supported Kotlin class. Currently supported are only regular
* Kotlin classes. Other class types (synthetic, SAM, lambdas) are not supported via reflection.
*
* @return {@literal true} if {@code type} is a supported Kotlin class.
* @since 2.0
* @deprecated since 2.3, use {@link KotlinReflectionUtils#isSupportedKotlinClass(Class)} instead.
*/
@Deprecated
public static boolean isSupportedKotlinClass(Class<?> type) {
return KotlinReflectionUtils.isSupportedKotlinClass(type);
}
/**
* Returns {@literal} whether the given {@link MethodParameter} is nullable. Nullable parameters are reference types
* and ones that are defined in Kotlin as such.
@@ -424,7 +399,8 @@ public final class ReflectionUtils {
return true;
}
if (isSupportedKotlinClass(parameter.getDeclaringClass())) {
if (KotlinDetector.isKotlinPresent()
&& KotlinReflectionUtils.isSupportedKotlinClass(parameter.getDeclaringClass())) {
return KotlinReflectionUtils.isNullable(parameter);
}

View File

@@ -25,9 +25,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.MethodParameter;
import org.springframework.core.log.LogMessage;
import org.springframework.data.domain.Pageable;
import org.springframework.hateoas.server.MethodLinkBuilderFactory;
import org.springframework.hateoas.server.core.MethodParameters;
import org.springframework.hateoas.server.mvc.WebMvcLinkBuilderFactory;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.support.WebDataBinderFactory;
@@ -53,21 +51,6 @@ public class PagedResourcesAssemblerArgumentResolver implements HandlerMethodArg
private final HateoasPageableHandlerMethodArgumentResolver resolver;
/**
* Creates a new {@link PagedResourcesAssemblerArgumentResolver} using the given
* {@link PageableHandlerMethodArgumentResolver} and {@link MethodLinkBuilderFactory}.
*
* @param resolver can be {@literal null}.
* @param linkBuilderFactory can be {@literal null}, will be defaulted to a {@link WebMvcLinkBuilderFactory}.
* @deprecated since 2.5, 2.4.4, 2.3.7, to be removed in 3.0
* @use {@link #PagedResourcesAssemblerArgumentResolver(HateoasPageableHandlerMethodArgumentResolver)} instead.
*/
@Deprecated
public PagedResourcesAssemblerArgumentResolver(HateoasPageableHandlerMethodArgumentResolver resolver,
@Nullable MethodLinkBuilderFactory<?> linkBuilderFactory) {
this(resolver);
}
/**
* Creates a new {@link PagedResourcesAssemblerArgumentResolver} using the given
* {@link PageableHandlerMethodArgumentResolver}.