Skip to content

Commit 0252054

Browse files
committed
Kotlin Updates per Detekt
1 parent bacb250 commit 0252054

19 files changed

+791
-57
lines changed

detekt-config.yml

Lines changed: 666 additions & 0 deletions
Large diffs are not rendered by default.

src/main/java/org/mybatis/dynamic/sql/select/GroupByModel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2018 the original author or authors.
2+
* Copyright 2016-2020 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.
@@ -16,7 +16,7 @@
1616
package org.mybatis.dynamic.sql.select;
1717

1818
import java.util.ArrayList;
19-
import java.util.Arrays;
19+
import java.util.Collection;
2020
import java.util.List;
2121
import java.util.function.Function;
2222
import java.util.stream.Stream;
@@ -26,15 +26,15 @@
2626
public class GroupByModel {
2727
private List<BasicColumn> columns = new ArrayList<>();
2828

29-
private GroupByModel(List<BasicColumn> columns) {
29+
private GroupByModel(Collection<BasicColumn> columns) {
3030
this.columns.addAll(columns);
3131
}
3232

3333
public <R> Stream<R> mapColumns(Function<BasicColumn, R> mapper) {
3434
return columns.stream().map(mapper);
3535
}
3636

37-
public static GroupByModel of(BasicColumn...columns) {
38-
return new GroupByModel(Arrays.asList(columns));
37+
public static GroupByModel of(Collection<BasicColumn> columns) {
38+
return new GroupByModel(columns);
3939
}
4040
}

src/main/java/org/mybatis/dynamic/sql/select/OrderByModel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2017 the original author or authors.
2+
* Copyright 2016-2020 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.
@@ -16,7 +16,7 @@
1616
package org.mybatis.dynamic.sql.select;
1717

1818
import java.util.ArrayList;
19-
import java.util.Arrays;
19+
import java.util.Collection;
2020
import java.util.List;
2121
import java.util.function.Function;
2222
import java.util.stream.Stream;
@@ -26,15 +26,15 @@
2626
public class OrderByModel {
2727
private List<SortSpecification> columns = new ArrayList<>();
2828

29-
private OrderByModel(List<SortSpecification> columns) {
29+
private OrderByModel(Collection<SortSpecification> columns) {
3030
this.columns.addAll(columns);
3131
}
3232

3333
public <R> Stream<R> mapColumns(Function<SortSpecification, R> mapper) {
3434
return columns.stream().map(mapper);
3535
}
3636

37-
public static OrderByModel of(SortSpecification...columns) {
38-
return new OrderByModel(Arrays.asList(columns));
37+
public static OrderByModel of(Collection<SortSpecification> columns) {
38+
return new OrderByModel(columns);
3939
}
4040
}

src/main/java/org/mybatis/dynamic/sql/select/QueryExpressionDSL.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.
@@ -115,11 +115,19 @@ public JoinSpecificationStarter fullJoin(SqlTable joinTable, String tableAlias)
115115
}
116116

117117
public GroupByFinisher groupBy(BasicColumn...columns) {
118+
return groupBy(Arrays.asList(columns));
119+
}
120+
121+
public GroupByFinisher groupBy(Collection<BasicColumn> columns) {
118122
groupByModel = GroupByModel.of(columns);
119123
return new GroupByFinisher();
120124
}
121125

122126
public SelectDSL<R> orderBy(SortSpecification...columns) {
127+
return orderBy(Arrays.asList(columns));
128+
}
129+
130+
public SelectDSL<R> orderBy(Collection<SortSpecification> columns) {
123131
selectDSL.orderBy(columns);
124132
return selectDSL;
125133
}

src/main/java/org/mybatis/dynamic/sql/select/SelectDSL.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.
@@ -138,7 +138,7 @@ QueryExpressionDSL<R> newQueryExpression(FromGatherer<R> fromGatherer, String ta
138138
return queryExpression;
139139
}
140140

141-
void orderBy(SortSpecification...columns) {
141+
void orderBy(Collection<SortSpecification> columns) {
142142
orderByModel = OrderByModel.of(columns);
143143
}
144144

src/main/java/org/mybatis/dynamic/sql/where/AbstractWhereDSL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/AbstractQueryExpressionDSLExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/AbstractWhereDSLExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/CriteriaCollector.kt

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,19 @@ class CriteriaCollector {
2727

2828
fun <T> and(column: BindableColumn<T>, condition: VisitableCondition<T>) =
2929
apply {
30-
criteria.add(SqlCriterion.withColumn(column)
31-
.withCondition(condition)
32-
.withConnector("and")
33-
.build())
30+
criteria.add(
31+
SqlCriterion.withColumn(column)
32+
.withCondition(condition)
33+
.withConnector("and")
34+
.build()
35+
)
3436
}
3537

36-
fun <T> and(column: BindableColumn<T>, condition: VisitableCondition<T>, collect: CriteriaCollector.() -> CriteriaCollector) =
38+
fun <T> and(
39+
column: BindableColumn<T>,
40+
condition: VisitableCondition<T>,
41+
collect: CriteriaCollector.() -> CriteriaCollector
42+
) =
3743
apply {
3844
val collector = CriteriaCollector()
3945
collect(collector)
@@ -47,13 +53,19 @@ class CriteriaCollector {
4753

4854
fun <T> or(column: BindableColumn<T>, condition: VisitableCondition<T>) =
4955
apply {
50-
criteria.add(SqlCriterion.withColumn(column)
51-
.withCondition(condition)
52-
.withConnector("or")
53-
.build())
56+
criteria.add(
57+
SqlCriterion.withColumn(column)
58+
.withCondition(condition)
59+
.withConnector("or")
60+
.build()
61+
)
5462
}
5563

56-
fun <T> or(column: BindableColumn<T>, condition: VisitableCondition<T>, collect: CriteriaCollector.() -> CriteriaCollector) =
64+
fun <T> or(
65+
column: BindableColumn<T>,
66+
condition: VisitableCondition<T>,
67+
collect: CriteriaCollector.() -> CriteriaCollector
68+
) =
5769
apply {
5870
val collector = CriteriaCollector()
5971
collect(collector)

src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/FromGathererExtensions.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.
@@ -26,5 +26,9 @@ typealias QueryExpressionEnhancer = QueryExpressionDSL<SelectModel>.() -> QueryE
2626
fun QueryExpressionDSL.FromGatherer<SelectModel>.from(table: SqlTable, enhancer: QueryExpressionEnhancer) =
2727
enhancer(from(table))
2828

29-
fun QueryExpressionDSL.FromGatherer<SelectModel>.from(table: SqlTable, alias: String, enhancer: QueryExpressionEnhancer) =
29+
fun QueryExpressionDSL.FromGatherer<SelectModel>.from(
30+
table: SqlTable,
31+
alias: String,
32+
enhancer: QueryExpressionEnhancer
33+
) =
3034
enhancer(from(table, alias))

0 commit comments

Comments
 (0)