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) {
188188 }
189189
190190 // functions
191+ @ SafeVarargs
191192 static <T extends Number > Add <T > add (BindableColumn <T >... columns ) {
192193 return Add .of (Arrays .asList (columns ));
193194 }
Original file line number Diff line number Diff line change 1616package org .mybatis .dynamic .sql .select .function ;
1717
1818import java .sql .JDBCType ;
19+ import java .util .ArrayList ;
1920import java .util .List ;
20- import java .util .Objects ;
2121import java .util .Optional ;
22- import java .util .StringJoiner ;
2322import java .util .stream .Collectors ;
2423
2524import org .mybatis .dynamic .sql .BindableColumn ;
2827public class Add <T extends Number > implements BindableColumn <T > {
2928
3029 private String alias ;
31- private List <BindableColumn <T >> columns ;
30+ private List <BindableColumn <T >> columns = new ArrayList <>() ;
3231
3332 private Add (List <BindableColumn <T >> columns ) {
34- this .columns = Objects . requireNonNull (columns );
33+ this .columns . addAll (columns );
3534 }
3635
3736 @ Override
@@ -42,8 +41,8 @@ public Optional<String> alias() {
4241 @ Override
4342 public String renderWithTableAlias (TableAliasCalculator tableAliasCalculator ) {
4443 return columns .stream ()
45- .map (column -> column .renderWithTableAlias (tableAliasCalculator ))
46- .collect (Collectors .joining (" + " ));
44+ .map (column -> column .renderWithTableAlias (tableAliasCalculator ))
45+ .collect (Collectors .joining (" + " ));
4746 }
4847
4948 @ Override
Original file line number Diff line number Diff line change 11/**
2- * Copyright 2016-2017 the original author or authors.
2+ * Copyright 2016-2018 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
You can’t perform that action at this time.
0 commit comments