File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
main/java/org/mybatis/dynamic/sql
test/java/examples/groupby Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ static Sum sum(BasicColumn column) {
188
188
}
189
189
190
190
// functions
191
+ @ SafeVarargs
191
192
static <T extends Number > Add <T > add (BindableColumn <T >... columns ) {
192
193
return Add .of (Arrays .asList (columns ));
193
194
}
Original file line number Diff line number Diff line change 16
16
package org .mybatis .dynamic .sql .select .function ;
17
17
18
18
import java .sql .JDBCType ;
19
+ import java .util .ArrayList ;
19
20
import java .util .List ;
20
- import java .util .Objects ;
21
21
import java .util .Optional ;
22
- import java .util .StringJoiner ;
23
22
import java .util .stream .Collectors ;
24
23
25
24
import org .mybatis .dynamic .sql .BindableColumn ;
28
27
public class Add <T extends Number > implements BindableColumn <T > {
29
28
30
29
private String alias ;
31
- private List <BindableColumn <T >> columns ;
30
+ private List <BindableColumn <T >> columns = new ArrayList <>() ;
32
31
33
32
private Add (List <BindableColumn <T >> columns ) {
34
- this .columns = Objects . requireNonNull (columns );
33
+ this .columns . addAll (columns );
35
34
}
36
35
37
36
@ Override
@@ -42,8 +41,8 @@ public Optional<String> alias() {
42
41
@ Override
43
42
public String renderWithTableAlias (TableAliasCalculator tableAliasCalculator ) {
44
43
return columns .stream ()
45
- .map (column -> column .renderWithTableAlias (tableAliasCalculator ))
46
- .collect (Collectors .joining (" + " ));
44
+ .map (column -> column .renderWithTableAlias (tableAliasCalculator ))
45
+ .collect (Collectors .joining (" + " ));
47
46
}
48
47
49
48
@ Override
Original file line number Diff line number Diff line change 1
1
/**
2
- * Copyright 2016-2017 the original author or authors.
2
+ * Copyright 2016-2018 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
You can’t perform that action at this time.
0 commit comments