Prefer implementing PersistentPropertyAccessor over PersistentPropertyPathAccessor.

In preparation of spring-projects/spring-data-commons#2813 we're moving off the implementation of PersistentPropertyPathAccessor and rather only implement PersistenPropertyAccessor.

Fixes #4354.
This commit is contained in:
Oliver Drotbohm
2023-04-04 11:10:27 +02:00
parent 5733a00f54
commit 5f48ee5644

View File

@@ -2443,7 +2443,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
}
}
private static class PropertyTranslatingPropertyAccessor<T> implements PersistentPropertyPathAccessor<T> {
private static class PropertyTranslatingPropertyAccessor<T> implements PersistentPropertyAccessor<T> {
private final PersistentPropertyAccessor<T> delegate;
private final PersistentPropertyTranslator propertyTranslator;
@@ -2460,7 +2460,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
}
@Override
public void setProperty(PersistentProperty property, @Nullable Object value) {
public void setProperty(PersistentProperty<?> property, @Nullable Object value) {
delegate.setProperty(translate(property), value);
}
@@ -2474,23 +2474,6 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
return delegate.getBean();
}
@Override
public void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, Object value,
AccessOptions.SetOptions options) {
throw new UnsupportedOperationException();
}
@Override
public Object getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path,
AccessOptions.GetOptions context) {
throw new UnsupportedOperationException();
}
@Override
public void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, Object value) {
throw new UnsupportedOperationException();
}
private MongoPersistentProperty translate(PersistentProperty<?> property) {
return propertyTranslator.translate((MongoPersistentProperty) property);
}