Skip to content

Commit 9b9508a

Browse files
committed
Polishing.
Fix since version. Update Javadoc. Adjust visibility for subclassing usage. See #1781
1 parent df60185 commit 9b9508a

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

spring-data-relational/src/main/java/org/springframework/data/relational/core/conversion/MappingRelationalConverter.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ public RelationalConverter getSourceConverter() {
878878
*
879879
* @param <T>
880880
*/
881-
interface ValueConverter<T> {
881+
protected interface ValueConverter<T> {
882882

883883
Object convert(T source, TypeInformation<?> typeHint);
884884

@@ -890,7 +890,7 @@ interface ValueConverter<T> {
890890
*
891891
* @param <T>
892892
*/
893-
interface ContainerValueConverter<T> {
893+
protected interface ContainerValueConverter<T> {
894894

895895
Object convert(ConversionContext context, T source, TypeInformation<?> typeHint);
896896

@@ -899,7 +899,9 @@ interface ContainerValueConverter<T> {
899899
}
900900

901901
/**
902-
* @since 3.4.3
902+
* Projecting variant of {@link ConversionContext} applying mapping-metadata rules from the related entity.
903+
*
904+
* @since 3.2
903905
*/
904906
protected class ProjectingConversionContext extends DefaultConversionContext {
905907

@@ -993,10 +995,19 @@ default ConversionContext forProperty(RelationalPersistentProperty property) {
993995
*/
994996
ConversionContext withPath(ObjectPath currentPath);
995997

998+
/**
999+
* @return the current {@link ObjectPath}. Can be {@link ObjectPath#ROOT} for top-level contexts.
1000+
*/
9961001
ObjectPath getPath();
9971002

1003+
/**
1004+
* @return the associated conversions.
1005+
*/
9981006
CustomConversions getCustomConversions();
9991007

1008+
/**
1009+
* @return source {@link RelationalConverter}.
1010+
*/
10001011
RelationalConverter getSourceConverter();
10011012

10021013
}
@@ -1082,6 +1093,7 @@ protected static final class DocumentValueProvider
10821093
private final RowDocumentAccessor accessor;
10831094
private final SpELExpressionEvaluator evaluator;
10841095
private final SpELContext spELContext;
1096+
private final RowDocument document;
10851097

10861098
/**
10871099
* Creates a new {@link RelationalPropertyValueProvider} for the given source and {@link SpELExpressionEvaluator}.
@@ -1100,6 +1112,7 @@ private DocumentValueProvider(ConversionContext context, RowDocumentAccessor acc
11001112
this.accessor = accessor;
11011113
this.evaluator = evaluator;
11021114
this.spELContext = spELContext;
1115+
this.document = accessor.getDocument();
11031116
}
11041117

11051118
@Override
@@ -1128,7 +1141,7 @@ public boolean hasValue(RelationalPersistentProperty property) {
11281141
@Override
11291142
public Object getValue(AggregatePath path) {
11301143

1131-
Object value = accessor.getDocument().get(path.getColumnInfo().alias().getReference());
1144+
Object value = document.get(path.getColumnInfo().alias().getReference());
11321145

11331146
if (value == null) {
11341147
return null;
@@ -1139,27 +1152,19 @@ public Object getValue(AggregatePath path) {
11391152

11401153
@Override
11411154
public boolean hasValue(AggregatePath path) {
1142-
return accessor.getDocument().get(path.getColumnInfo().alias().getReference()) != null;
1155+
return document.get(path.getColumnInfo().alias().getReference()) != null;
11431156
}
11441157

11451158
@Override
11461159
public boolean hasValue(SqlIdentifier identifier) {
1147-
return accessor().getDocument().get(identifier.getReference()) != null;
1160+
return document.get(identifier.getReference()) != null;
11481161
}
11491162

11501163
@Override
11511164
public DocumentValueProvider withContext(ConversionContext context) {
11521165
return context == this.context ? this : new DocumentValueProvider(context, accessor, evaluator, spELContext);
11531166
}
11541167

1155-
public ConversionContext context() {
1156-
return context;
1157-
}
1158-
1159-
public RowDocumentAccessor accessor() {
1160-
return accessor;
1161-
}
1162-
11631168
}
11641169

11651170
/**

spring-data-relational/src/main/java/org/springframework/data/relational/core/conversion/RowDocumentAccessor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public RowDocument getDocument() {
6060
* @param source
6161
*/
6262
public void putAll(RowDocument source) {
63-
6463
document.putAll(source);
6564
}
6665

0 commit comments

Comments
 (0)