Skip to content

Commit 49a4ff3

Browse files
schaudermp911de
authored andcommitted
#220 - Polishing.
Formatting. Fix warnings. JavaDoc. Adjusted nullability annotations. Original pull request: #287.
1 parent 01eccbb commit 49a4ff3

11 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

+3-13
Original file line numberDiff line numberDiff line change
@@ -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

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class R2dbcEntityTemplate implements R2dbcEntityOperations, BeanFactoryAw
7373
/**
7474
* Create a new {@link R2dbcEntityTemplate} given {@link DatabaseClient}.
7575
*
76-
* @param databaseClient
76+
* @param databaseClient must not be {@literal null}.
7777
*/
7878
public R2dbcEntityTemplate(DatabaseClient databaseClient) {
7979
this(databaseClient, getDataAccessStrategy(databaseClient));
@@ -82,7 +82,7 @@ public R2dbcEntityTemplate(DatabaseClient databaseClient) {
8282
/**
8383
* Create a new {@link R2dbcEntityTemplate} given {@link DatabaseClient} and {@link ReactiveDataAccessStrategy}.
8484
*
85-
* @param databaseClient
85+
* @param databaseClient must not be {@literal null}.
8686
*/
8787
public R2dbcEntityTemplate(DatabaseClient databaseClient, ReactiveDataAccessStrategy strategy) {
8888

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/core/StatementMapper.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -460,11 +460,12 @@ public Map<SqlIdentifier, SettableValue> getAssignments() {
460460
class UpdateSpec {
461461

462462
private final SqlIdentifier table;
463+
@Nullable
463464
private final Update update;
464465

465466
private final @Nullable Criteria criteria;
466467

467-
protected UpdateSpec(SqlIdentifier table, Update update, @Nullable Criteria criteria) {
468+
protected UpdateSpec(SqlIdentifier table, @Nullable Update update, @Nullable Criteria criteria) {
468469

469470
this.table = table;
470471
this.update = update;
@@ -506,6 +507,7 @@ public SqlIdentifier getTable() {
506507
return this.table;
507508
}
508509

510+
@Nullable
509511
public Update getUpdate() {
510512
return this.update;
511513
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ private Query(@Nullable Criteria criteria) {
6868
}
6969

7070
private Query(@Nullable Criteria criteria, List<SqlIdentifier> columns, Sort sort, int limit, long offset) {
71+
7172
this.criteria = criteria;
7273
this.columns = columns;
7374
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)