Skip to content

Commit

Permalink
Remove @Deprecated API.
Browse files Browse the repository at this point in the history
See #3208
  • Loading branch information
mp911de committed Jan 14, 2025
1 parent 7caefb3 commit 18d66a4
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 432 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.springframework.data.mapping.Association;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.util.ClassUtils;
import org.springframework.data.util.KotlinReflectionUtils;
import org.springframework.data.util.Lazy;
import org.springframework.data.util.ReflectionUtils;
Expand All @@ -50,7 +51,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
static {

CAUSE_FIELD = ReflectionUtils.getRequiredField(Throwable.class, "cause");
ASSOCIATION_TYPE = ReflectionUtils.loadIfPresent("org.jmolecules.ddd.types.Association",
ASSOCIATION_TYPE = ClassUtils.loadIfPresent("org.jmolecules.ddd.types.Association",
AbstractPersistentProperty.class.getClassLoader());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import org.springframework.data.mapping.MappingException;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.util.ClassUtils;
import org.springframework.data.util.Lazy;
import org.springframework.data.util.Optionals;
import org.springframework.data.util.ReflectionUtils;
import org.springframework.data.util.StreamUtils;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
Expand Down Expand Up @@ -316,7 +316,7 @@ private Stream<? extends AnnotatedElement> getAccessors() {
@SuppressWarnings("unchecked")
private static Class<? extends Annotation> loadIdentityType() {

return (Class<? extends Annotation>) ReflectionUtils.loadIfPresent("org.jmolecules.ddd.annotation.Identity",
return (Class<? extends Annotation>) ClassUtils.loadIfPresent("org.jmolecules.ddd.annotation.Identity",
AbstractPersistentProperty.class.getClassLoader());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,11 @@ private static boolean shouldExposeMetadata(RepositoryFragments fragments) {
*/
static class ImplementationMethodExecutionInterceptor implements MethodInterceptor {

private final RepositoryInformation information;
private final RepositoryComposition composition;
private final RepositoryInvocationMulticaster invocationMulticaster;

public ImplementationMethodExecutionInterceptor(RepositoryInformation information,
RepositoryComposition composition, List<RepositoryMethodInvocationListener> methodInvocationListeners) {
this.information = information;
this.composition = composition;
this.invocationMulticaster = methodInvocationListeners.isEmpty() ? NoOpRepositoryInvocationMulticaster.INSTANCE
: new DefaultRepositoryInvocationMulticaster(methodInvocationListeners);
Expand Down
204 changes: 0 additions & 204 deletions src/main/java/org/springframework/data/repository/util/ClassUtils.java

This file was deleted.

28 changes: 0 additions & 28 deletions src/main/java/org/springframework/data/util/CastUtils.java

This file was deleted.

64 changes: 0 additions & 64 deletions src/main/java/org/springframework/data/util/ReflectionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.springframework.beans.BeanUtils;
import org.springframework.core.KotlinDetector;
import org.springframework.core.MethodParameter;
import org.springframework.core.ResolvableType;
Expand Down Expand Up @@ -98,27 +97,6 @@ public static int getParameterCount(Method method, Predicate<Class<?>> predicate
return (int) Arrays.stream(method.getParameterTypes()).filter(predicate).count();
}

/**
* Creates an instance of the class with the given fully qualified name or returns the given default instance if the
* class cannot be loaded or instantiated.
*
* @param classname the fully qualified class name to create an instance for.
* @param defaultInstance the instance to fall back to in case the given class cannot be loaded or instantiated.
* @return
* @deprecated since 3.5 as it is not used within the framework anymore.
*/
@SuppressWarnings("unchecked")
@Deprecated(since = "3.5", forRemoval = true)
public static <T> T createInstanceIfPresent(String classname, T defaultInstance) {

try {
Class<?> type = ClassUtils.forName(classname, ClassUtils.getDefaultClassLoader());
return (T) BeanUtils.instantiateClass(type);
} catch (Exception e) {
return defaultInstance;
}
}

/**
* Check whether the given {@code type} represents a void type such as {@code void}, {@link Void} or Kotlin
* {@code Unit}.
Expand Down Expand Up @@ -264,20 +242,6 @@ public static Field findField(Class<?> type, DescribedFieldFilter filter, boolea
return foundField;
}

/**
* Finds the field of the given name on the given type.
*
* @param type must not be {@literal null}.
* @param name must not be {@literal null} or empty.
* @return the required field.
* @throws IllegalArgumentException in case the field can't be found.
* @deprecated use {@link #getRequiredField(Class, String)} instead.
*/
@Deprecated(since = "3.5", forRemoval = true)
public static Field findRequiredField(Class<?> type, String name) {
return getRequiredField(type, name);
}

/**
* Obtains the required field of the given name on the given type or throws {@link IllegalArgumentException} if the
* found could not be found.
Expand Down Expand Up @@ -411,20 +375,6 @@ public static Stream<Class<?>> returnTypeAndParameters(Method method) {
return Stream.concat(returnType, parameterTypes);
}

/**
* Returns the {@link Method} with the given name and parameters declared on the given type, if available.
*
* @param type must not be {@literal null}.
* @param name must not be {@literal null} or empty.
* @param parameterTypes must not be {@literal null}.
* @return the optional Method.
* @since 2.0
*/
@Deprecated(since = "3.5", forRemoval = true)
public static Optional<Method> getMethod(Class<?> type, String name, ResolvableType... parameterTypes) {
return Optional.ofNullable(findMethod(type, name, parameterTypes));
}

/**
* Returns the {@link Method} with the given name and parameters declared on the given type, if available.
*
Expand Down Expand Up @@ -557,18 +507,4 @@ public static Object getPrimitiveDefault(Class<?> type) {
throw new IllegalArgumentException(String.format("Primitive type %s not supported", type));
}

/**
* Loads the class with the given name using the given {@link ClassLoader}.
*
* @param name the name of the class to be loaded.
* @param classLoader the {@link ClassLoader} to use to load the class.
* @return the {@link Class} or {@literal null} in case the class can't be loaded for any reason.
* @since 2.5
*/
@Nullable
@Deprecated(since = "3.5", forRemoval = true)
public static Class<?> loadIfPresent(String name, ClassLoader classLoader) {
return org.springframework.data.util.ClassUtils.loadIfPresent(name, classLoader);
}

}
Loading

0 comments on commit 18d66a4

Please sign in to comment.