Skip to content

Commit f3e8a84

Browse files
authored
Merge pull request #235 from jeffgbutler/master
Final all the things
2 parents cacbf1b + a3afbf2 commit f3e8a84

File tree

98 files changed

+310
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+310
-308
lines changed

src/main/java/org/mybatis/dynamic/sql/AbstractColumnComparisonCondition.java

+2-2
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.
@@ -19,7 +19,7 @@
1919

2020
public abstract class AbstractColumnComparisonCondition<T> implements VisitableCondition<T> {
2121

22-
protected BasicColumn column;
22+
protected final BasicColumn column;
2323

2424
protected AbstractColumnComparisonCondition(BasicColumn column) {
2525
this.column = column;

src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import java.util.stream.Stream;
2424

2525
public abstract class AbstractListValueCondition<T> implements VisitableCondition<T> {
26-
protected Collection<T> values;
27-
protected UnaryOperator<Stream<T>> valueStreamTransformer;
26+
protected final Collection<T> values;
27+
protected final UnaryOperator<Stream<T>> valueStreamTransformer;
2828
protected boolean renderWhenEmpty = false;
2929

3030
protected AbstractListValueCondition(Collection<T> values) {

src/main/java/org/mybatis/dynamic/sql/AbstractNoValueCondition.java

+2-2
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.
@@ -20,7 +20,7 @@
2020

2121
public abstract class AbstractNoValueCondition<T> implements VisitableCondition<T> {
2222

23-
private BooleanSupplier booleanSupplier;
23+
private final BooleanSupplier booleanSupplier;
2424

2525
protected AbstractNoValueCondition() {
2626
booleanSupplier = () -> true;

src/main/java/org/mybatis/dynamic/sql/AbstractSingleValueCondition.java

+3-3
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.
@@ -20,8 +20,8 @@
2020
import java.util.function.Supplier;
2121

2222
public abstract class AbstractSingleValueCondition<T> implements VisitableCondition<T> {
23-
protected Supplier<T> valueSupplier;
24-
private Predicate<T> predicate;
23+
protected final Supplier<T> valueSupplier;
24+
private final Predicate<T> predicate;
2525

2626
protected AbstractSingleValueCondition(Supplier<T> valueSupplier) {
2727
this.valueSupplier = Objects.requireNonNull(valueSupplier);

src/main/java/org/mybatis/dynamic/sql/AbstractSubselectCondition.java

+2-2
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.
@@ -19,7 +19,7 @@
1919
import org.mybatis.dynamic.sql.util.Buildable;
2020

2121
public abstract class AbstractSubselectCondition<T> implements VisitableCondition<T> {
22-
private SelectModel selectModel;
22+
private final SelectModel selectModel;
2323

2424
protected AbstractSubselectCondition(Buildable<SelectModel> selectModelBuilder) {
2525
this.selectModel = selectModelBuilder.build();

src/main/java/org/mybatis/dynamic/sql/AbstractTwoValueCondition.java

+6-5
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.
@@ -20,9 +20,9 @@
2020
import java.util.function.Supplier;
2121

2222
public abstract class AbstractTwoValueCondition<T> implements VisitableCondition<T> {
23-
protected Supplier<T> valueSupplier1;
24-
protected Supplier<T> valueSupplier2;
25-
private BiPredicate<T, T> predicate;
23+
protected final Supplier<T> valueSupplier1;
24+
protected final Supplier<T> valueSupplier2;
25+
private final BiPredicate<T, T> predicate;
2626

2727
protected AbstractTwoValueCondition(Supplier<T> valueSupplier1, Supplier<T> valueSupplier2) {
2828
this.valueSupplier1 = Objects.requireNonNull(valueSupplier1);
@@ -32,7 +32,8 @@ protected AbstractTwoValueCondition(Supplier<T> valueSupplier1, Supplier<T> valu
3232

3333
protected AbstractTwoValueCondition(Supplier<T> valueSupplier1, Supplier<T> valueSupplier2,
3434
BiPredicate<T, T> predicate) {
35-
this(valueSupplier1, valueSupplier2);
35+
this.valueSupplier1 = Objects.requireNonNull(valueSupplier1);
36+
this.valueSupplier2 = Objects.requireNonNull(valueSupplier2);
3637
this.predicate = Objects.requireNonNull(predicate);
3738
}
3839

src/main/java/org/mybatis/dynamic/sql/Constant.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class Constant<T> implements BindableColumn<T> {
2424

2525
private String alias;
26-
private String value;
26+
private final String value;
2727

2828
private Constant(String value) {
2929
this.value = Objects.requireNonNull(value);

src/main/java/org/mybatis/dynamic/sql/SortSpecification.java

+2-2
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.
@@ -40,7 +40,7 @@ public interface SortSpecification {
4040
/**
4141
* Return true if the sort order is descending.
4242
*
43-
* @return true if the SortSpcification should render as descending
43+
* @return true if the SortSpecification should render as descending
4444
*/
4545
boolean isDescending();
4646
}

src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static SortSpecification sortColumn(String name) {
734734

735735
class InsertIntoNextStep {
736736

737-
private SqlTable table;
737+
private final SqlTable table;
738738

739739
private InsertIntoNextStep(SqlTable table) {
740740
this.table = Objects.requireNonNull(table);

src/main/java/org/mybatis/dynamic/sql/SqlColumn.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
public class SqlColumn<T> implements BindableColumn<T>, SortSpecification {
2727

28-
protected String name;
29-
protected SqlTable table;
30-
protected JDBCType jdbcType;
28+
protected final String name;
29+
protected final SqlTable table;
30+
protected final JDBCType jdbcType;
3131
protected boolean isDescending = false;
3232
protected String alias;
3333
protected String typeHandler;

src/main/java/org/mybatis/dynamic/sql/SqlCriterion.java

+6-6
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.
@@ -24,10 +24,10 @@
2424

2525
public class SqlCriterion<T> {
2626

27-
private BindableColumn<T> column;
28-
private VisitableCondition<T> condition;
29-
private String connector;
30-
private List<SqlCriterion<?>> subCriteria;
27+
private final BindableColumn<T> column;
28+
private final VisitableCondition<T> condition;
29+
private final String connector;
30+
private final List<SqlCriterion<?>> subCriteria;
3131

3232
private SqlCriterion(Builder<T> builder) {
3333
connector = builder.connector;
@@ -60,7 +60,7 @@ public static class Builder<T> {
6060
private String connector;
6161
private BindableColumn<T> column;
6262
private VisitableCondition<T> condition;
63-
private List<SqlCriterion<?>> subCriteria = new ArrayList<>();
63+
private final List<SqlCriterion<?>> subCriteria = new ArrayList<>();
6464

6565
public Builder<T> withConnector(String connector) {
6666
this.connector = connector;

src/main/java/org/mybatis/dynamic/sql/SqlTable.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
public class SqlTable {
2525

26-
private Supplier<String> nameSupplier;
26+
private final Supplier<String> nameSupplier;
2727

2828
protected SqlTable(String tableName) {
2929
Objects.requireNonNull(tableName);

src/main/java/org/mybatis/dynamic/sql/StringConstant.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public class StringConstant implements BindableColumn<String> {
2424

2525
private String alias;
26-
private String value;
26+
private final String value;
2727

2828
private StringConstant(String value) {
2929
this.value = Objects.requireNonNull(value);

src/main/java/org/mybatis/dynamic/sql/delete/DeleteDSL.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333

3434
public class DeleteDSL<R> implements Buildable<R> {
3535

36-
private Function<DeleteModel, R> adapterFunction;
37-
private SqlTable table;
38-
private DeleteWhereBuilder whereBuilder = new DeleteWhereBuilder();
36+
private final Function<DeleteModel, R> adapterFunction;
37+
private final SqlTable table;
38+
private final DeleteWhereBuilder whereBuilder = new DeleteWhereBuilder();
3939

4040
private DeleteDSL(SqlTable table, Function<DeleteModel, R> adapterFunction) {
4141
this.table = Objects.requireNonNull(table);

src/main/java/org/mybatis/dynamic/sql/delete/DeleteModel.java

+3-3
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,8 +26,8 @@
2626
import org.mybatis.dynamic.sql.where.WhereModel;
2727

2828
public class DeleteModel {
29-
private SqlTable table;
30-
private WhereModel whereModel;
29+
private final SqlTable table;
30+
private final WhereModel whereModel;
3131

3232
private DeleteModel(Builder builder) {
3333
table = Objects.requireNonNull(builder.table);

src/main/java/org/mybatis/dynamic/sql/delete/MyBatis3DeleteModelAdapter.java

+3-3
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.
@@ -33,8 +33,8 @@
3333
@Deprecated
3434
public class MyBatis3DeleteModelAdapter<R> {
3535

36-
private DeleteModel deleteModel;
37-
private Function<DeleteStatementProvider, R> mapperMethod;
36+
private final DeleteModel deleteModel;
37+
private final Function<DeleteStatementProvider, R> mapperMethod;
3838

3939
private MyBatis3DeleteModelAdapter(DeleteModel deleteModel, Function<DeleteStatementProvider, R> mapperMethod) {
4040
this.deleteModel = Objects.requireNonNull(deleteModel);

src/main/java/org/mybatis/dynamic/sql/delete/render/DefaultDeleteStatementProvider.java

+4-4
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.
@@ -20,8 +20,8 @@
2020
import java.util.Objects;
2121

2222
public class DefaultDeleteStatementProvider implements DeleteStatementProvider {
23-
private String deleteStatement;
24-
private Map<String, Object> parameters;
23+
private final String deleteStatement;
24+
private final Map<String, Object> parameters;
2525

2626
private DefaultDeleteStatementProvider(Builder builder) {
2727
deleteStatement = Objects.requireNonNull(builder.deleteStatement);
@@ -44,7 +44,7 @@ public static Builder withDeleteStatement(String deleteStatement) {
4444

4545
public static class Builder {
4646
private String deleteStatement;
47-
private Map<String, Object> parameters = new HashMap<>();
47+
private final Map<String, Object> parameters = new HashMap<>();
4848

4949
public Builder withDeleteStatement(String deleteStatement) {
5050
this.deleteStatement = deleteStatement;

src/main/java/org/mybatis/dynamic/sql/delete/render/DeleteRenderer.java

+3-3
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.
@@ -29,8 +29,8 @@
2929
import org.mybatis.dynamic.sql.where.render.WhereRenderer;
3030

3131
public class DeleteRenderer {
32-
private DeleteModel deleteModel;
33-
private RenderingStrategy renderingStrategy;
32+
private final DeleteModel deleteModel;
33+
private final RenderingStrategy renderingStrategy;
3434

3535
private DeleteRenderer(Builder builder) {
3636
deleteModel = Objects.requireNonNull(builder.deleteModel);

src/main/java/org/mybatis/dynamic/sql/insert/AbstractMultiRowInsertModel.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import org.mybatis.dynamic.sql.util.AbstractColumnMapping;
2828

2929
public abstract class AbstractMultiRowInsertModel<T> {
30-
private SqlTable table;
31-
private List<T> records;
32-
private List<AbstractColumnMapping> columnMappings;
30+
private final SqlTable table;
31+
private final List<T> records;
32+
private final List<AbstractColumnMapping> columnMappings;
3333

3434
protected AbstractMultiRowInsertModel(AbstractBuilder<T, ?> builder) {
3535
table = Objects.requireNonNull(builder.table);
@@ -55,8 +55,8 @@ public int recordCount() {
5555

5656
public abstract static class AbstractBuilder<T, S extends AbstractBuilder<T, S>> {
5757
private SqlTable table;
58-
private List<T> records = new ArrayList<>();
59-
private List<AbstractColumnMapping> columnMappings = new ArrayList<>();
58+
private final List<T> records = new ArrayList<>();
59+
private final List<AbstractColumnMapping> columnMappings = new ArrayList<>();
6060

6161
public S withTable(SqlTable table) {
6262
this.table = table;

src/main/java/org/mybatis/dynamic/sql/insert/BatchInsertDSL.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
public class BatchInsertDSL<T> implements Buildable<BatchInsertModel<T>> {
3434

35-
private Collection<T> records;
36-
private SqlTable table;
37-
private List<AbstractColumnMapping> columnMappings = new ArrayList<>();
35+
private final Collection<T> records;
36+
private final SqlTable table;
37+
private final List<AbstractColumnMapping> columnMappings = new ArrayList<>();
3838

3939
private BatchInsertDSL(Collection<T> records, SqlTable table) {
4040
this.records = records;
@@ -64,7 +64,7 @@ public static <T> IntoGatherer<T> insert(Collection<T> records) {
6464
}
6565

6666
public static class IntoGatherer<T> {
67-
private Collection<T> records;
67+
private final Collection<T> records;
6868

6969
private IntoGatherer(Collection<T> records) {
7070
this.records = records;
@@ -76,7 +76,7 @@ public BatchInsertDSL<T> into(SqlTable table) {
7676
}
7777

7878
public class ColumnMappingFinisher<F> {
79-
private SqlColumn<F> column;
79+
private final SqlColumn<F> column;
8080

8181
public ColumnMappingFinisher(SqlColumn<F> column) {
8282
this.column = column;

src/main/java/org/mybatis/dynamic/sql/insert/GeneralInsertDSL.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import org.mybatis.dynamic.sql.util.ValueWhenPresentMapping;
3333

3434
public class GeneralInsertDSL implements Buildable<GeneralInsertModel> {
35-
private List<AbstractColumnMapping> insertMappings = new ArrayList<>();
36-
private SqlTable table;
35+
private final List<AbstractColumnMapping> insertMappings = new ArrayList<>();
36+
private final SqlTable table;
3737

3838
private GeneralInsertDSL(SqlTable table) {
3939
this.table = Objects.requireNonNull(table);
@@ -58,7 +58,7 @@ public static GeneralInsertDSL insertInto(SqlTable table) {
5858

5959
public class SetClauseFinisher<T> {
6060

61-
private SqlColumn<T> column;
61+
private final SqlColumn<T> column;
6262

6363
public SetClauseFinisher(SqlColumn<T> column) {
6464
this.column = column;

src/main/java/org/mybatis/dynamic/sql/insert/GeneralInsertModel.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
public class GeneralInsertModel {
3232

33-
private SqlTable table;
34-
private List<AbstractColumnMapping> insertMappings;
33+
private final SqlTable table;
34+
private final List<AbstractColumnMapping> insertMappings;
3535

3636
private GeneralInsertModel(Builder builder) {
3737
table = Objects.requireNonNull(builder.table);
@@ -56,7 +56,7 @@ public GeneralInsertStatementProvider render(RenderingStrategy renderingStrategy
5656

5757
public static class Builder {
5858
private SqlTable table;
59-
private List<AbstractColumnMapping> insertMappings = new ArrayList<>();
59+
private final List<AbstractColumnMapping> insertMappings = new ArrayList<>();
6060

6161
public Builder withTable(SqlTable table) {
6262
this.table = table;

0 commit comments

Comments
 (0)