Skip to content

Commit d640d61

Browse files
valery1707mp911de
authored andcommitted
Remove an extra level in the class hierarchy.
Closes #1574
1 parent 7c33fb7 commit d640d61

File tree

2 files changed

+51
-53
lines changed

2 files changed

+51
-53
lines changed

Diff for: spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/convert/R2dbcConverters.java

+46-49
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030

3131
import org.springframework.core.convert.converter.Converter;
3232
import org.springframework.core.convert.converter.ConverterFactory;
33-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToOffsetDateTimeConverter;
34-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToStringConverter;
35-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToUuidConverter;
36-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToZonedDateTimeConverter;
3733
import org.springframework.util.Assert;
3834
import org.springframework.util.NumberUtils;
3935

@@ -42,6 +38,7 @@
4238
*
4339
* @author Hebert Coelho
4440
* @author Mark Paluch
41+
* @author Valeriy Vyrva
4542
*/
4643
abstract class R2dbcConverters {
4744

@@ -169,66 +166,66 @@ public T convert(Row source) {
169166
return (object != null ? NumberUtils.convertNumberToTargetClass((Number) object, this.targetType) : null);
170167
}
171168
}
169+
}
172170

173-
/**
174-
* Simple singleton to convert {@link Row}s to their {@link OffsetDateTime} representation.
175-
*
176-
* @author Hebert Coelho
177-
*/
178-
public enum RowToOffsetDateTimeConverter implements Converter<Row, OffsetDateTime> {
171+
/**
172+
* Simple singleton to convert {@link Row}s to their {@link OffsetDateTime} representation.
173+
*
174+
* @author Hebert Coelho
175+
*/
176+
public enum RowToOffsetDateTimeConverter implements Converter<Row, OffsetDateTime> {
179177

180-
INSTANCE;
178+
INSTANCE;
181179

182-
@Override
183-
public OffsetDateTime convert(Row row) {
184-
return row.get(0, OffsetDateTime.class);
185-
}
180+
@Override
181+
public OffsetDateTime convert(Row row) {
182+
return row.get(0, OffsetDateTime.class);
186183
}
184+
}
187185

188-
/**
189-
* Simple singleton to convert {@link Row}s to their {@link String} representation.
190-
*
191-
* @author Hebert Coelho
192-
*/
193-
public enum RowToStringConverter implements Converter<Row, String> {
186+
/**
187+
* Simple singleton to convert {@link Row}s to their {@link String} representation.
188+
*
189+
* @author Hebert Coelho
190+
*/
191+
public enum RowToStringConverter implements Converter<Row, String> {
194192

195-
INSTANCE;
193+
INSTANCE;
196194

197-
@Override
198-
public String convert(Row row) {
199-
return row.get(0, String.class);
200-
}
195+
@Override
196+
public String convert(Row row) {
197+
return row.get(0, String.class);
201198
}
199+
}
202200

203-
/**
204-
* Simple singleton to convert {@link Row}s to their {@link UUID} representation.
205-
*
206-
* @author Hebert Coelho
207-
*/
208-
public enum RowToUuidConverter implements Converter<Row, UUID> {
201+
/**
202+
* Simple singleton to convert {@link Row}s to their {@link UUID} representation.
203+
*
204+
* @author Hebert Coelho
205+
*/
206+
public enum RowToUuidConverter implements Converter<Row, UUID> {
209207

210-
INSTANCE;
208+
INSTANCE;
211209

212-
@Override
213-
public UUID convert(Row row) {
214-
return row.get(0, UUID.class);
215-
}
210+
@Override
211+
public UUID convert(Row row) {
212+
return row.get(0, UUID.class);
216213
}
214+
}
217215

218-
/**
219-
* Simple singleton to convert {@link Row}s to their {@link ZonedDateTime} representation.
220-
*
221-
* @author Hebert Coelho
222-
*/
223-
public enum RowToZonedDateTimeConverter implements Converter<Row, ZonedDateTime> {
216+
/**
217+
* Simple singleton to convert {@link Row}s to their {@link ZonedDateTime} representation.
218+
*
219+
* @author Hebert Coelho
220+
*/
221+
public enum RowToZonedDateTimeConverter implements Converter<Row, ZonedDateTime> {
224222

225-
INSTANCE;
223+
INSTANCE;
226224

227-
@Override
228-
public ZonedDateTime convert(Row row) {
229-
return row.get(0, ZonedDateTime.class);
230-
}
225+
@Override
226+
public ZonedDateTime convert(Row row) {
227+
return row.get(0, ZonedDateTime.class);
231228
}
232-
233229
}
230+
234231
}

Diff for: spring-data-r2dbc/src/test/java/org/springframework/data/r2dbc/convert/R2dbcConvertersUnitTests.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@
3535
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToLocalDateTimeConverter;
3636
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToLocalTimeConverter;
3737
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory;
38-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToOffsetDateTimeConverter;
39-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToStringConverter;
40-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToUuidConverter;
41-
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToNumberConverterFactory.RowToZonedDateTimeConverter;
38+
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToOffsetDateTimeConverter;
39+
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToStringConverter;
40+
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToUuidConverter;
41+
import org.springframework.data.r2dbc.convert.R2dbcConverters.RowToZonedDateTimeConverter;
4242

4343
/**
4444
* Unit tests for {@link R2dbcConverters}.
4545
*
4646
* @author Hebert Coelho
4747
* @author Mark Paluch
48+
* @author Valeriy Vyrva
4849
*/
4950
public class R2dbcConvertersUnitTests {
5051

0 commit comments

Comments
 (0)