Skip to content

Commit

Permalink
Remove @Deprecated API.
Browse files Browse the repository at this point in the history
Closes #3208
  • Loading branch information
mp911de committed Nov 19, 2024
1 parent 542d928 commit 5e2c751
Show file tree
Hide file tree
Showing 70 changed files with 90 additions and 3,048 deletions.

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/org/springframework/data/geo/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package org.springframework.data.geo;

import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

Expand All @@ -40,7 +40,7 @@ public class Circle implements Shape {
* @param center must not be {@literal null}.
* @param radius must not be {@literal null} and it's value greater or equal to zero.
*/
@PersistenceConstructor
@PersistenceCreator
public Circle(Point center, Distance radius) {

Assert.notNull(center, "Center point must not be null");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/springframework/data/geo/GeoResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Iterator;
import java.util.List;

import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
Expand Down Expand Up @@ -67,7 +67,7 @@ public GeoResults(List<? extends GeoResult<T>> results, Metric metric) {
* @param results must not be {@literal null}.
* @param averageDistance must not be {@literal null}.
*/
@PersistenceConstructor
@PersistenceCreator
public GeoResults(List<? extends GeoResult<T>> results, Distance averageDistance) {

Assert.notNull(results, "Results must not be null");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/springframework/data/geo/Point.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.io.Serializable;
import java.util.Locale;

import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

Expand All @@ -43,7 +43,7 @@ public class Point implements Serializable {
* @param x
* @param y
*/
@PersistenceConstructor
@PersistenceCreator
public Point(double x, double y) {
this.x = x;
this.y = y;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/springframework/data/geo/Polygon.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Iterator;
import java.util.List;

import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
Expand Down Expand Up @@ -67,7 +67,7 @@ public Polygon(Point x, Point y, Point z, Point... others) {
*
* @param points must not be {@literal null}.
*/
@PersistenceConstructor
@PersistenceCreator
public Polygon(List<? extends Point> points) {

Assert.notNull(points, "Points must not be null");
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/springframework/data/mapping/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ public Class<T> getRawType() {
* Returns the expression to be used when looking up a source data structure to populate the actual parameter value.
*
* @return the expression to be used when looking up a source data structure.
* @deprecated since 3.3, use {@link #getValueExpression()} instead.
*/
@Nullable
public String getSpelExpression() {
Expand Down Expand Up @@ -165,17 +164,6 @@ public String getRequiredValueExpression() {
return getValueExpression();
}

/**
* Returns whether the constructor parameter is equipped with a SpEL expression.
*
* @return {@literal true}} if the parameter is equipped with a SpEL expression.
* @deprecated since 3.3, use {@link #hasValueExpression()} instead.
*/
@Deprecated(since = "3.3")
public boolean hasSpelExpression() {
return hasValueExpression();
}

/**
* Returns whether the constructor parameter is equipped with a value expression.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
*/
String getName();

/**
* Returns the {@link PreferredConstructor} to be used to instantiate objects of this {@link PersistentEntity}.
*
* @return {@literal null} in case no suitable constructor for automatic construction can be found. This usually
* indicates that the instantiation of the object of that persistent entity is done through either a
* customer {@link org.springframework.data.mapping.model.EntityInstantiator} or handled by custom
* conversion mechanisms entirely.
* @deprecated since 3.0, use {@link #getInstanceCreatorMetadata()}.
*/
@Nullable
@Deprecated
PreferredConstructor<T, P> getPersistenceConstructor();

/**
* Returns the {@link InstanceCreatorMetadata} to be used to instantiate objects of this {@link PersistentEntity}.
*
Expand All @@ -68,20 +55,6 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
@Nullable
InstanceCreatorMetadata<P> getInstanceCreatorMetadata();

/**
* Returns whether the given {@link PersistentProperty} is referred to by a constructor argument of the
* {@link PersistentEntity}.
*
* @param property can be {@literal null}.
* @return true if the given {@link PersistentProperty} is referred to by a constructor argument or {@literal false}
* if not or {@literal null}.
* @deprecated since 3.0, use {@link #isCreatorArgument(PersistentProperty)} instead.
*/
@Deprecated
default boolean isConstructorArgument(PersistentProperty<?> property) {
return isCreatorArgument(property);
}

/**
* Returns whether the given {@link PersistentProperty} is referred to by a creator argument of the
* {@link PersistentEntity}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,6 @@ public interface PersistentPropertyPath<P extends PersistentProperty<P>> extends
*/
P getLeafProperty();

/**
* Returns the last property in the {@link PersistentPropertyPath}. So for {@code foo.bar} it will return the
* {@link PersistentProperty} for {@code bar}. For a simple {@code foo} it returns {@link PersistentProperty} for
* {@code foo}.
*
* @return will never be {@literal null}.
* @deprecated use {@link #getLeafProperty()} instead.
*/
@Deprecated(since = "3.1", forRemoval = true)
default P getRequiredLeafProperty() {
return getLeafProperty();
}

/**
* Returns the first property in the {@link PersistentPropertyPath}. So for {@code foo.bar} it will return the
* {@link PersistentProperty} for {@code foo}. For a simple {@code foo} it returns {@link PersistentProperty} for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.List;

import org.springframework.core.annotation.MergedAnnotations;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.annotation.PersistenceCreator;
import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;
Expand All @@ -36,7 +35,6 @@
* @author Myeonghyeon Lee
* @author Xeno Amess
*/
@SuppressWarnings("deprecation")
public final class PreferredConstructor<T, P extends PersistentProperty<P>>
extends InstanceCreatorMetadataSupport<T, P> {

Expand Down Expand Up @@ -78,26 +76,15 @@ public boolean isNoArgConstructor() {
}

/**
* Returns whether the constructor was explicitly selected (by {@link PersistenceConstructor}).
* Returns whether the constructor was explicitly selected (by {@link PersistenceCreator}).
*
* @return
* @return {@literal true} if the constructor was explicitly selected.
*/
public boolean isExplicitlyAnnotated() {

var annotations = MergedAnnotations.from(getExecutable());

return annotations.isPresent(PersistenceConstructor.class)
|| annotations.isPresent(PersistenceCreator.class);
}

/**
* @param property
* @return
* @deprecated since 3.0, use {@link #isCreatorParameter(PersistentProperty)} instead.
*/
@Deprecated
public boolean isConstructorParameter(PersistentProperty<?> property) {
return isCreatorParameter(property);
return annotations.isPresent(PersistenceCreator.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,6 @@ public BasicPersistentEntity(TypeInformation<T> information, @Nullable Comparato
.anyMatch(it -> !(isCreatorArgument(it) || it.isTransient())));
}

@Nullable
@Override
@SuppressWarnings("unchecked")
public PreferredConstructor<T, P> getPersistenceConstructor() {
return creator instanceof PreferredConstructor ? (PreferredConstructor<T, P>) creator : null;
}

@Nullable
@Override
public InstanceCreatorMetadata<P> getInstanceCreatorMetadata() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.asm.Opcodes;
import org.springframework.asm.Type;
import org.springframework.beans.BeanInstantiationException;
import org.springframework.beans.BeanUtils;
import org.springframework.cglib.core.ReflectUtils;
import org.springframework.core.NativeDetector;
import org.springframework.data.mapping.FactoryMethod;
Expand Down Expand Up @@ -159,8 +160,7 @@ private EntityInstantiator createEntityInstantiator(PersistentEntity<?, ?> entit
* @return
*/
protected EntityInstantiator doCreateEntityInstantiator(PersistentEntity<?, ?> entity) {
return new EntityInstantiatorAdapter(
createObjectInstantiator(entity, entity.getInstanceCreatorMetadata()));
return new EntityInstantiatorAdapter(createObjectInstantiator(entity, entity.getInstanceCreatorMetadata()));
}

/**
Expand Down Expand Up @@ -239,7 +239,8 @@ ObjectInstantiator createObjectInstantiator(PersistentEntity<?, ?> entity,
@Nullable InstanceCreatorMetadata<?> constructor) {

try {
return (ObjectInstantiator) this.generator.generateCustomInstantiatorClass(entity, constructor).newInstance();
Class<?> instantiatorClass = this.generator.generateCustomInstantiatorClass(entity, constructor);
return (ObjectInstantiator) BeanUtils.instantiateClass(instantiatorClass);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -482,8 +483,7 @@ private void visitCreateMethod(ClassWriter cw, PersistentEntity<?, ?> entity,
String entityTypeResourcePath = Type.getInternalName(entity.getType());

MethodVisitor mv = cw.visitMethod(ACC_PUBLIC + ACC_VARARGS, CREATE_METHOD_NAME,
"([" + BytecodeUtil.referenceName(Object.class) + ")" + BytecodeUtil.referenceName(Object.class),
null, null);
"([" + BytecodeUtil.referenceName(Object.class) + ")" + BytecodeUtil.referenceName(Object.class), null, null);
mv.visitCode();
mv.visitTypeInsn(NEW, entityTypeResourcePath);
mv.visitInsn(DUP);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,6 @@ public Optional<Class<?>> getEntityType() {
return Optional.ofNullable(entityType);
}

/**
* The constructor used during the instantiation attempt.
*
* @return the constructor
* @deprecated since 3.0, use {@link #getEntityCreator()} instead.
*/
@Deprecated
public Optional<Constructor<?>> getConstructor() {
return getEntityCreator().filter(PreferredConstructor.class::isInstance).map(PreferredConstructor.class::cast)
.map(PreferredConstructor::getConstructor);
}

/**
* The entity creator used during the instantiation attempt.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@

/**
* {@link ParameterValueProvider} based on a {@link PersistentEntity} to use a {@link PropertyValueProvider} to lookup
* the value of the property referenced by the given {@link Parameter}. Additionally a
* {@link DefaultSpELExpressionEvaluator} can be configured to get property value resolution trumped by a SpEL
* expression evaluation.
* the value of the property referenced by the given {@link Parameter}.
*
* @author Oliver Gierke
* @author Johannes Englmeier
Expand Down
Loading

0 comments on commit 5e2c751

Please sign in to comment.