Skip to content

Commit 8a5fe30

Browse files
committed
#220 - Polishing.
Formatting. Fix warnings. JavaDoc.
1 parent 9669497 commit 8a5fe30

10 files changed

+19
-47
lines changed

Diff for: src/main/java/org/springframework/data/r2dbc/core/DefaultDatabaseClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ private static void bindByIndex(Statement statement, Map<Integer, SettableValue>
309309
byIndex.forEach((i, o) -> {
310310

311311
if (o.getValue() != null) {
312-
statement.bind(i.intValue(), o.getValue());
312+
statement.bind(i, o.getValue());
313313
} else {
314-
statement.bindNull(i.intValue(), o.getType());
314+
statement.bindNull(i, o.getType());
315315
}
316316
});
317317
}

Diff for: src/main/java/org/springframework/data/r2dbc/core/DefaultStatementMapper.java

+4-14
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private PreparedOperation<Update> getMappedObject(UpdateSpec updateSpec,
188188
BindMarkers bindMarkers = this.dialect.getBindMarkersFactory().create();
189189
Table table = Table.create(toSql(updateSpec.getTable()));
190190

191-
if (updateSpec.getUpdate() == null || updateSpec.getUpdate().getAssignments().isEmpty()) {
191+
if (updateSpec.getUpdate().getAssignments().isEmpty()) {
192192
throw new IllegalArgumentException("UPDATE contains no assignments");
193193
}
194194

@@ -255,24 +255,13 @@ private PreparedOperation<Delete> getMappedObject(DeleteSpec deleteSpec,
255255
* (non-Javadoc)
256256
* @see org.springframework.data.r2dbc.function.StatementMapper#toSql(SqlIdentifier)
257257
*/
258-
public String toSql(SqlIdentifier identifier) {
258+
private String toSql(SqlIdentifier identifier) {
259259

260260
Assert.notNull(identifier, "SqlIdentifier must not be null");
261261

262262
return identifier.toSql(this.dialect.getIdentifierProcessing());
263263
}
264264

265-
private List<String> toSql(List<SqlIdentifier> identifiers) {
266-
267-
List<String> list = new ArrayList<>(identifiers.size());
268-
269-
for (SqlIdentifier sqlIdentifier : identifiers) {
270-
list.add(toSql(sqlIdentifier));
271-
}
272-
273-
return list;
274-
}
275-
276265
/**
277266
* Default implementation of {@link PreparedOperation}.
278267
*
@@ -284,7 +273,8 @@ static class DefaultPreparedOperation<T> implements PreparedOperation<T> {
284273
private final RenderContext renderContext;
285274
private final Bindings bindings;
286275

287-
public DefaultPreparedOperation(T source, RenderContext renderContext, Bindings bindings) {
276+
DefaultPreparedOperation(T source, RenderContext renderContext, Bindings bindings) {
277+
288278
this.source = source;
289279
this.renderContext = renderContext;
290280
this.bindings = bindings;

Diff for: src/main/java/org/springframework/data/r2dbc/core/R2dbcEntityTemplate.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class R2dbcEntityTemplate implements R2dbcEntityOperations, BeanFactoryAw
7474
/**
7575
* Create a new {@link R2dbcEntityTemplate} given {@link DatabaseClient}.
7676
*
77-
* @param databaseClient
77+
* @param databaseClient must not be {@literal null}.
7878
*/
7979
public R2dbcEntityTemplate(DatabaseClient databaseClient) {
8080

@@ -89,7 +89,7 @@ public R2dbcEntityTemplate(DatabaseClient databaseClient) {
8989
/**
9090
* Create a new {@link R2dbcEntityTemplate} given {@link DatabaseClient} and {@link ReactiveDataAccessStrategy}.
9191
*
92-
* @param databaseClient
92+
* @param databaseClient must not be {@literal null}.
9393
*/
9494
public R2dbcEntityTemplate(DatabaseClient databaseClient, ReactiveDataAccessStrategy strategy) {
9595

@@ -485,6 +485,7 @@ private static ReactiveDataAccessStrategy getDataAccessStrategy(DatabaseClient d
485485
ReactiveDataAccessStrategy strategy) {
486486

487487
if (strategy instanceof DefaultReactiveDataAccessStrategy) {
488+
488489
DefaultReactiveDataAccessStrategy strategy1 = (DefaultReactiveDataAccessStrategy) strategy;
489490
return strategy1.getMappingContext();
490491
}

Diff for: src/main/java/org/springframework/data/r2dbc/core/ReactiveDeleteOperationSupport.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,13 @@ public ReactiveDelete delete(Class<?> domainType) {
5151
static class ReactiveDeleteSupport implements ReactiveDelete, TerminatingDelete {
5252

5353
private final R2dbcEntityTemplate template;
54-
5554
private final Class<?> domainType;
56-
5755
private final Query query;
58-
5956
private final @Nullable SqlIdentifier tableName;
6057

6158
ReactiveDeleteSupport(R2dbcEntityTemplate template, Class<?> domainType, Query query,
6259
@Nullable SqlIdentifier tableName) {
60+
6361
this.template = template;
6462
this.domainType = domainType;
6563
this.query = query;

Diff for: src/main/java/org/springframework/data/r2dbc/core/ReactiveInsertOperationSupport.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ public <T> ReactiveInsert<T> insert(Class<T> domainType) {
5050
static class ReactiveInsertSupport<T> implements ReactiveInsert<T> {
5151

5252
private final R2dbcEntityTemplate template;
53-
5453
private final Class<T> domainType;
55-
5654
private final @Nullable SqlIdentifier tableName;
5755

5856
ReactiveInsertSupport(R2dbcEntityTemplate template, Class<T> domainType, @Nullable SqlIdentifier tableName) {
57+
5958
this.template = template;
6059
this.domainType = domainType;
6160
this.tableName = tableName;

Diff for: src/main/java/org/springframework/data/r2dbc/core/ReactiveSelectOperationSupport.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,14 @@ public <T> ReactiveSelect<T> select(Class<T> domainType) {
5252
static class ReactiveSelectSupport<T> implements ReactiveSelect<T> {
5353

5454
private final R2dbcEntityTemplate template;
55-
5655
private final Class<?> domainType;
57-
5856
private final Class<T> returnType;
59-
6057
private final Query query;
61-
6258
private final @Nullable SqlIdentifier tableName;
6359

6460
ReactiveSelectSupport(R2dbcEntityTemplate template, Class<?> domainType, Class<T> returnType, Query query,
6561
@Nullable SqlIdentifier tableName) {
62+
6663
this.template = template;
6764
this.domainType = domainType;
6865
this.returnType = returnType;

Diff for: src/main/java/org/springframework/data/r2dbc/core/ReactiveUpdateOperationSupport.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ public ReactiveUpdate update(Class<?> domainType) {
5252
static class ReactiveUpdateSupport implements ReactiveUpdate, TerminatingUpdate {
5353

5454
private final R2dbcEntityTemplate template;
55-
5655
private final Class<?> domainType;
57-
5856
private final Query query;
59-
6057
private final @Nullable SqlIdentifier tableName;
6158

6259
ReactiveUpdateSupport(R2dbcEntityTemplate template, Class<?> domainType, Query query,
6360
@Nullable SqlIdentifier tableName) {
61+
6462
this.template = template;
6563
this.domainType = domainType;
6664
this.query = query;

Diff for: src/main/java/org/springframework/data/r2dbc/query/Criteria.java

+2-15
Original file line numberDiff line numberDiff line change
@@ -165,101 +165,88 @@ public interface CriteriaStep {
165165
* Creates a {@link Criteria} using equality.
166166
*
167167
* @param value must not be {@literal null}.
168-
* @return
169168
*/
170169
Criteria is(Object value);
171170

172171
/**
173172
* Creates a {@link Criteria} using equality (is not).
174173
*
175174
* @param value must not be {@literal null}.
176-
* @return
177175
*/
178176
Criteria not(Object value);
179177

180178
/**
181179
* Creates a {@link Criteria} using {@code IN}.
182180
*
183181
* @param values must not be {@literal null}.
184-
* @return
185182
*/
186183
Criteria in(Object... values);
187184

188185
/**
189186
* Creates a {@link Criteria} using {@code IN}.
190187
*
191188
* @param values must not be {@literal null}.
192-
* @return
193189
*/
194-
Criteria in(Collection<? extends Object> values);
190+
Criteria in(Collection<?> values);
195191

196192
/**
197193
* Creates a {@link Criteria} using {@code NOT IN}.
198194
*
199195
* @param values must not be {@literal null}.
200-
* @return
201196
*/
202197
Criteria notIn(Object... values);
203198

204199
/**
205200
* Creates a {@link Criteria} using {@code NOT IN}.
206201
*
207202
* @param values must not be {@literal null}.
208-
* @return
209203
*/
210-
Criteria notIn(Collection<? extends Object> values);
204+
Criteria notIn(Collection<?> values);
211205

212206
/**
213207
* Creates a {@link Criteria} using less-than ({@literal <}).
214208
*
215209
* @param value must not be {@literal null}.
216-
* @return
217210
*/
218211
Criteria lessThan(Object value);
219212

220213
/**
221214
* Creates a {@link Criteria} using less-than or equal to ({@literal <=}).
222215
*
223216
* @param value must not be {@literal null}.
224-
* @return
225217
*/
226218
Criteria lessThanOrEquals(Object value);
227219

228220
/**
229221
* Creates a {@link Criteria} using greater-than({@literal >}).
230222
*
231223
* @param value must not be {@literal null}.
232-
* @return
233224
*/
234225
Criteria greaterThan(Object value);
235226

236227
/**
237228
* Creates a {@link Criteria} using greater-than or equal to ({@literal >=}).
238229
*
239230
* @param value must not be {@literal null}.
240-
* @return
241231
*/
242232
Criteria greaterThanOrEquals(Object value);
243233

244234
/**
245235
* Creates a {@link Criteria} using {@code LIKE}.
246236
*
247237
* @param value must not be {@literal null}.
248-
* @return
249238
*/
250239
Criteria like(Object value);
251240

252241
/**
253242
* Creates a {@link Criteria} using {@code IS NULL}.
254243
*
255-
* @return
256244
*/
257245
Criteria isNull();
258246

259247
/**
260248
* Creates a {@link Criteria} using {@code IS NOT NULL}.
261249
*
262-
* @return
263250
*/
264251
Criteria isNotNull();
265252
}

Diff for: src/main/java/org/springframework/data/r2dbc/query/Query.java

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public static Query query(Criteria criteria) {
6464
* @param criteria must not be {@literal null}.
6565
*/
6666
private Query(@Nullable Criteria criteria) {
67+
6768
this.criteria = criteria;
6869
this.sort = Sort.unsorted();
6970
this.columns = Collections.emptyList();
@@ -72,6 +73,7 @@ private Query(@Nullable Criteria criteria) {
7273
}
7374

7475
private Query(@Nullable Criteria criteria, List<SqlIdentifier> columns, Sort sort, int limit, long offset) {
76+
7577
this.criteria = criteria;
7678
this.columns = columns;
7779
this.sort = sort;

Diff for: src/main/java/org/springframework/data/r2dbc/query/QueryMapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ public Expression getMappedObject(Expression expression, @Nullable RelationalPer
156156
Field field = createPropertyField(entity, column.getName());
157157
Table table = column.getTable();
158158

159-
return column instanceof Aliased ? table.column(field.getMappedColumnName()).as(((Aliased) column).getAlias())
160-
: table.column(field.getMappedColumnName());
159+
Column columnFromTable = table.column(field.getMappedColumnName());
160+
return column instanceof Aliased ? columnFromTable.as(((Aliased) column).getAlias()) : columnFromTable;
161161
}
162162

163163
if (expression instanceof SimpleFunction) {

0 commit comments

Comments
 (0)