Skip to content

Commit 9400628

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

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ public RelationalConverter getSourceConverter() {
902902
*
903903
* @param <T>
904904
*/
905-
interface ValueConverter<T> {
905+
protected interface ValueConverter<T> {
906906

907907
Object convert(T source, TypeInformation<?> typeHint);
908908

@@ -914,7 +914,7 @@ interface ValueConverter<T> {
914914
*
915915
* @param <T>
916916
*/
917-
interface ContainerValueConverter<T> {
917+
protected interface ContainerValueConverter<T> {
918918

919919
Object convert(ConversionContext context, T source, TypeInformation<?> typeHint);
920920

@@ -923,7 +923,9 @@ interface ContainerValueConverter<T> {
923923
}
924924

925925
/**
926-
* @since 3.4.3
926+
* Projecting variant of {@link ConversionContext} applying mapping-metadata rules from the related entity.
927+
*
928+
* @since 3.2
927929
*/
928930
protected class ProjectingConversionContext extends DefaultConversionContext {
929931

@@ -1017,10 +1019,19 @@ default ConversionContext forProperty(RelationalPersistentProperty property) {
10171019
*/
10181020
ConversionContext withPath(ObjectPath currentPath);
10191021

1022+
/**
1023+
* @return the current {@link ObjectPath}. Can be {@link ObjectPath#ROOT} for top-level contexts.
1024+
*/
10201025
ObjectPath getPath();
10211026

1027+
/**
1028+
* @return the associated conversions.
1029+
*/
10221030
CustomConversions getCustomConversions();
10231031

1032+
/**
1033+
* @return source {@link RelationalConverter}.
1034+
*/
10241035
RelationalConverter getSourceConverter();
10251036

10261037
}
@@ -1106,6 +1117,7 @@ protected static final class DocumentValueProvider
11061117
private final RowDocumentAccessor accessor;
11071118
private final ValueExpressionEvaluator evaluator;
11081119
private final SpELContext spELContext;
1120+
private final RowDocument document;
11091121

11101122
/**
11111123
* Creates a new {@link RelationalPropertyValueProvider} for the given source and {@link ValueExpressionEvaluator}.
@@ -1120,10 +1132,12 @@ private DocumentValueProvider(ConversionContext context, RowDocumentAccessor acc
11201132
Assert.notNull(context, "ConversionContext must no be null");
11211133
Assert.notNull(accessor, "DocumentAccessor must no be null");
11221134
Assert.notNull(evaluator, "ValueExpressionEvaluator must not be null");
1135+
11231136
this.context = context;
11241137
this.accessor = accessor;
11251138
this.evaluator = evaluator;
11261139
this.spELContext = spELContext;
1140+
this.document = accessor.getDocument();
11271141
}
11281142

11291143
@Override
@@ -1152,7 +1166,7 @@ public boolean hasValue(RelationalPersistentProperty property) {
11521166
@Override
11531167
public Object getValue(AggregatePath path) {
11541168

1155-
Object value = accessor.getDocument().get(path.getColumnInfo().alias().getReference());
1169+
Object value = document.get(path.getColumnInfo().alias().getReference());
11561170

11571171
if (value == null) {
11581172
return null;
@@ -1163,27 +1177,19 @@ public Object getValue(AggregatePath path) {
11631177

11641178
@Override
11651179
public boolean hasValue(AggregatePath path) {
1166-
return accessor.getDocument().get(path.getColumnInfo().alias().getReference()) != null;
1180+
return document.get(path.getColumnInfo().alias().getReference()) != null;
11671181
}
11681182

11691183
@Override
11701184
public boolean hasValue(SqlIdentifier identifier) {
1171-
return accessor().getDocument().get(identifier.getReference()) != null;
1185+
return document.get(identifier.getReference()) != null;
11721186
}
11731187

11741188
@Override
11751189
public DocumentValueProvider withContext(ConversionContext context) {
11761190
return context == this.context ? this : new DocumentValueProvider(context, accessor, evaluator, spELContext);
11771191
}
11781192

1179-
public ConversionContext context() {
1180-
return context;
1181-
}
1182-
1183-
public RowDocumentAccessor accessor() {
1184-
return accessor;
1185-
}
1186-
11871193
}
11881194

11891195
/**

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)