Polishing.

Fix since version. Update Javadoc. Adjust visibility for subclassing usage.

See #1781
This commit is contained in:
Mark Paluch
2024-04-29 11:28:09 +02:00
parent ea865cafc5
commit 940062816d
2 changed files with 20 additions and 15 deletions

View File

@@ -902,7 +902,7 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
*
* @param <T>
*/
interface ValueConverter<T> {
protected interface ValueConverter<T> {
Object convert(T source, TypeInformation<?> typeHint);
@@ -914,7 +914,7 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
*
* @param <T>
*/
interface ContainerValueConverter<T> {
protected interface ContainerValueConverter<T> {
Object convert(ConversionContext context, T source, TypeInformation<?> typeHint);
@@ -923,7 +923,9 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
}
/**
* @since 3.4.3
* Projecting variant of {@link ConversionContext} applying mapping-metadata rules from the related entity.
*
* @since 3.2
*/
protected class ProjectingConversionContext extends DefaultConversionContext {
@@ -1017,10 +1019,19 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
*/
ConversionContext withPath(ObjectPath currentPath);
/**
* @return the current {@link ObjectPath}. Can be {@link ObjectPath#ROOT} for top-level contexts.
*/
ObjectPath getPath();
/**
* @return the associated conversions.
*/
CustomConversions getCustomConversions();
/**
* @return source {@link RelationalConverter}.
*/
RelationalConverter getSourceConverter();
}
@@ -1106,6 +1117,7 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
private final RowDocumentAccessor accessor;
private final ValueExpressionEvaluator evaluator;
private final SpELContext spELContext;
private final RowDocument document;
/**
* Creates a new {@link RelationalPropertyValueProvider} for the given source and {@link ValueExpressionEvaluator}.
@@ -1120,10 +1132,12 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
Assert.notNull(context, "ConversionContext must no be null");
Assert.notNull(accessor, "DocumentAccessor must no be null");
Assert.notNull(evaluator, "ValueExpressionEvaluator must not be null");
this.context = context;
this.accessor = accessor;
this.evaluator = evaluator;
this.spELContext = spELContext;
this.document = accessor.getDocument();
}
@Override
@@ -1152,7 +1166,7 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
@Override
public Object getValue(AggregatePath path) {
Object value = accessor.getDocument().get(path.getColumnInfo().alias().getReference());
Object value = document.get(path.getColumnInfo().alias().getReference());
if (value == null) {
return null;
@@ -1163,12 +1177,12 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
@Override
public boolean hasValue(AggregatePath path) {
return accessor.getDocument().get(path.getColumnInfo().alias().getReference()) != null;
return document.get(path.getColumnInfo().alias().getReference()) != null;
}
@Override
public boolean hasValue(SqlIdentifier identifier) {
return accessor().getDocument().get(identifier.getReference()) != null;
return document.get(identifier.getReference()) != null;
}
@Override
@@ -1176,14 +1190,6 @@ public class MappingRelationalConverter extends AbstractRelationalConverter
return context == this.context ? this : new DocumentValueProvider(context, accessor, evaluator, spELContext);
}
public ConversionContext context() {
return context;
}
public RowDocumentAccessor accessor() {
return accessor;
}
}
/**

View File

@@ -60,7 +60,6 @@ public class RowDocumentAccessor {
* @param source
*/
public void putAll(RowDocument source) {
document.putAll(source);
}