Skip to content

Commit b42809e

Browse files
committed
Polishing.
Fix typos. Add since tag. See #2078 Original pull request: #2081
1 parent 3fec94a commit b42809e

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MappingJdbcConverter.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public class MappingJdbcConverter extends MappingRelationalConverter implements
8080
* {@link #MappingJdbcConverter(RelationalMappingContext, RelationResolver, CustomConversions, JdbcTypeFactory)}
8181
* (MappingContext, RelationResolver, JdbcTypeFactory)} to convert arrays and large objects into JDBC-specific types.
8282
*
83-
* @param context must not be {@literal null}.
83+
* @param context must not be {@literal null}.
8484
* @param relationResolver used to fetch additional relations from the database. Must not be {@literal null}.
8585
*/
8686
public MappingJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver) {
@@ -98,12 +98,12 @@ public MappingJdbcConverter(RelationalMappingContext context, RelationResolver r
9898
/**
9999
* Creates a new {@link MappingJdbcConverter} given {@link MappingContext}.
100100
*
101-
* @param context must not be {@literal null}.
101+
* @param context must not be {@literal null}.
102102
* @param relationResolver used to fetch additional relations from the database. Must not be {@literal null}.
103-
* @param typeFactory must not be {@literal null}
103+
* @param typeFactory must not be {@literal null}
104104
*/
105105
public MappingJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver,
106-
CustomConversions conversions, JdbcTypeFactory typeFactory) {
106+
CustomConversions conversions, JdbcTypeFactory typeFactory) {
107107

108108
super(context, conversions);
109109

@@ -258,18 +258,18 @@ public JdbcValue writeJdbcValue(@Nullable Object value, TypeInformation<?> colum
258258

259259
if (convertedValue.getClass().isArray()) {
260260

261-
if (componentType != byte.class && componentType != Byte.class) {
261+
if (componentType != byte.class && componentType != Byte.class) {
262262

263-
Object[] objectArray = requireObjectArray(convertedValue);
264-
return JdbcValue.of(typeFactory.createArray(objectArray), JDBCType.ARRAY);
265-
}
263+
Object[] objectArray = requireObjectArray(convertedValue);
264+
return JdbcValue.of(typeFactory.createArray(objectArray), JDBCType.ARRAY);
265+
}
266266

267-
if (componentType == Byte.class) {
268-
convertedValue = ArrayUtils.toPrimitive((Byte[]) convertedValue);
269-
}
267+
if (componentType == Byte.class) {
268+
convertedValue = ArrayUtils.toPrimitive((Byte[]) convertedValue);
269+
}
270270

271-
return JdbcValue.of(convertedValue, JDBCType.BINARY);
272-
}
271+
return JdbcValue.of(convertedValue, JDBCType.BINARY);
272+
}
273273

274274
return JdbcValue.of(convertedValue, sqlType);
275275
}
@@ -306,7 +306,7 @@ public <R> R readAndResolve(TypeInformation<R> type, RowDocument source, Identif
306306

307307
@Override
308308
protected RelationalPropertyValueProvider newValueProvider(RowDocumentAccessor documentAccessor,
309-
ValueExpressionEvaluator evaluator, ConversionContext context) {
309+
ValueExpressionEvaluator evaluator, ConversionContext context) {
310310

311311
if (context instanceof ResolvingConversionContext rcc) {
312312

@@ -335,7 +335,7 @@ class ResolvingRelationalPropertyValueProvider implements RelationalPropertyValu
335335
private final Identifier identifier;
336336

337337
private ResolvingRelationalPropertyValueProvider(AggregatePathValueProvider delegate, RowDocumentAccessor accessor,
338-
ResolvingConversionContext context, Identifier identifier) {
338+
ResolvingConversionContext context, Identifier identifier) {
339339

340340
AggregatePath path = context.aggregatePath();
341341

@@ -344,15 +344,15 @@ private ResolvingRelationalPropertyValueProvider(AggregatePathValueProvider dele
344344
this.context = context;
345345
this.identifier = path.isEntity()
346346
? potentiallyAppendIdentifier(identifier, path.getRequiredLeafEntity(),
347-
property -> delegate.getValue(path.append(property)))
347+
property -> delegate.getValue(path.append(property)))
348348
: identifier;
349349
}
350350

351351
/**
352352
* Conditionally append the identifier if the entity has an identifier property.
353353
*/
354354
static Identifier potentiallyAppendIdentifier(Identifier base, RelationalPersistentEntity<?> entity,
355-
Function<RelationalPersistentProperty, Object> getter) {
355+
Function<RelationalPersistentProperty, Object> getter) {
356356

357357
if (entity.hasIdProperty()) {
358358

@@ -481,7 +481,7 @@ public RelationalPropertyValueProvider withContext(ConversionContext context) {
481481

482482
return context == this.context ? this
483483
: new ResolvingRelationalPropertyValueProvider(delegate.withContext(context), accessor,
484-
(ResolvingConversionContext) context, identifier);
484+
(ResolvingConversionContext) context, identifier);
485485
}
486486
}
487487

@@ -493,7 +493,7 @@ public RelationalPropertyValueProvider withContext(ConversionContext context) {
493493
* @param identifier
494494
*/
495495
private record ResolvingConversionContext(ConversionContext delegate, AggregatePath aggregatePath,
496-
Identifier identifier) implements ConversionContext {
496+
Identifier identifier) implements ConversionContext {
497497

498498
@Override
499499
public <S> S convert(Object source, TypeInformation<? extends S> typeHint) {

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@
4444
import org.springframework.data.mapping.PersistentPropertyAccessor;
4545
import org.springframework.data.mapping.PersistentPropertyPathAccessor;
4646
import org.springframework.data.mapping.context.MappingContext;
47-
import org.springframework.data.mapping.model.*;
47+
import org.springframework.data.mapping.model.CachingValueExpressionEvaluatorFactory;
48+
import org.springframework.data.mapping.model.ConvertingPropertyAccessor;
49+
import org.springframework.data.mapping.model.EntityInstantiator;
50+
import org.springframework.data.mapping.model.ParameterValueProvider;
51+
import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider;
52+
import org.springframework.data.mapping.model.PropertyValueProvider;
53+
import org.springframework.data.mapping.model.SimpleTypeHolder;
54+
import org.springframework.data.mapping.model.SpELContext;
55+
import org.springframework.data.mapping.model.ValueExpressionEvaluator;
56+
import org.springframework.data.mapping.model.ValueExpressionParameterValueProvider;
4857
import org.springframework.data.projection.EntityProjection;
4958
import org.springframework.data.projection.EntityProjectionIntrospector;
5059
import org.springframework.data.projection.EntityProjectionIntrospector.ProjectionPredicate;
@@ -792,16 +801,18 @@ private Object writeCollection(Iterable<?> value, TypeInformation<?> type) {
792801
Class<?> targetComponentType = mapped.get(0).getClass();
793802
targetType = Array.newInstance(targetComponentType, 0).getClass();
794803
}
804+
795805
return getConversionService().convert(mapped, targetType);
796806
}
797807

798808
/**
799-
* Unwraps technology specific wrappers. Custom conversions may choose to return a wrapper class that contains additional information for the technology driver.
800-
* These wrappers can't be used as members of a collection, therefore we may have to unwrap the values.
801-
*
802-
* This method allows technology specific implemenations to provide such an unwrapping mechanism.
809+
* Unwraps technology-specific wrappers. Custom conversions may choose to return a wrapper class that contains
810+
* additional information for the driver. These wrappers can't be used as members of a collection, therefore we may
811+
* have to unwrap the values. This method allows technology-specific implementations to provide such an unwrapping
812+
* mechanism.
803813
*
804814
* @param convertedValue a value that might need unwrapping.
815+
* @since 3.5.2
805816
*/
806817
@Nullable
807818
protected Object unwrap(@Nullable Object convertedValue) {

0 commit comments

Comments
 (0)