Skip to content

Commit ce0f57a

Browse files
committed
Rename *Support classes to *Provider
1 parent a339fda commit ce0f57a

File tree

57 files changed

+668
-668
lines changed

Some content is hidden

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

57 files changed

+668
-668
lines changed

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ One capability is that very expressive dynamic queries can be generated. Here's
5858
try {
5959
AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
6060

61-
SelectSupport selectSupport = select(id, animalName, bodyWeight, brainWeight)
61+
SelectProvider selectProvider = select(id, animalName, bodyWeight, brainWeight)
6262
.from(animalData)
6363
.where(id, isIn(1, 5, 7))
6464
.or(id, isIn(2, 6, 8), and(animalName, isLike("%bat")))
@@ -68,7 +68,7 @@ One capability is that very expressive dynamic queries can be generated. Here's
6868
.build()
6969
.render(RenderingStrategy.MYBATIS3);
7070

71-
List<AnimalData> animals = mapper.selectMany(selectSupport);
71+
List<AnimalData> animals = mapper.selectMany(selectProvider);
7272
assertThat(animals.size()).isEqualTo(4);
7373
} finally {
7474
sqlSession.close();
@@ -158,8 +158,8 @@ import org.apache.ibatis.annotations.Delete;
158158
import org.apache.ibatis.annotations.Result;
159159
import org.apache.ibatis.annotations.Results;
160160
import org.apache.ibatis.annotations.Select;
161-
import org.mybatis.dynamic.sql.delete.render.DeleteSupport;
162-
import org.mybatis.dynamic.sql.select.render.SelectSupport;
161+
import org.mybatis.dynamic.sql.delete.render.DeleteProvider;
162+
import org.mybatis.dynamic.sql.select.render.SelectProvider;
163163

164164
public class SimpleTableAnnotatedMapper {
165165

@@ -174,12 +174,12 @@ public class SimpleTableAnnotatedMapper {
174174
@Result(column="employed", property="employed", jdbcType=JdbcType.VARCHAR, typeHandler=YesNoTypeHandler.class),
175175
@Result(column="occupation", property="occupation", jdbcType=JdbcType.VARCHAR)
176176
})
177-
List<SimpleTableRecord> selectMany(SelectSupport selectSupport);
177+
List<SimpleTableRecord> selectMany(SelectProvider selectProvider);
178178

179179
@Delete({
180180
"${fullDeleteStatement}"
181181
})
182-
int delete(DeleteSupport deleteSupport);
182+
int delete(DeleteProvider deleteProvider);
183183
}
184184
```
185185
An XML mapper might look like this:
@@ -216,7 +216,7 @@ All conditions can be accessed through expressive static methods in the ```org.m
216216
For example, a very simple select statement can be defined like this:
217217

218218
```java
219-
SelectSupport selectSupport = select(count())
219+
SelectProvider selectProvider = select(count())
220220
.from(simpleTable)
221221
.where(id, isEqualTo(3))
222222
.build()
@@ -226,7 +226,7 @@ For example, a very simple select statement can be defined like this:
226226
Or this (also note that you can give a table an alias):
227227

228228
```java
229-
SelectSupport selectSupport = select(count())
229+
SelectProvider selectProvider = select(count())
230230
.from(simpleTable, "a")
231231
.where(id, isNull())
232232
.build()
@@ -235,7 +235,7 @@ Or this (also note that you can give a table an alias):
235235
A delete statement looks like this:
236236

237237
```java
238-
DeleteSupport deleteSupport = deleteFrom(simpleTable)
238+
DeleteProvider deleteProvider = deleteFrom(simpleTable)
239239
.where(occupation, isNull())
240240
.build()
241241
.render(RenderingStrategy.MYBATIS3);
@@ -244,7 +244,7 @@ A delete statement looks like this:
244244
The "between" condition is also expressive:
245245

246246
```java
247-
SelectSupport selectSupport = select(count())
247+
SelectProvider selectProvider = select(count())
248248
.from(simpleTable)
249249
.where(id, isBetween(1).and(4))
250250
.build()
@@ -254,7 +254,7 @@ The "between" condition is also expressive:
254254
More complex expressions can be built using the "and" and "or" conditions as follows:
255255

256256
```java
257-
SelectSupport selectSupport = select(count())
257+
SelectProvider selectProvider = select(count())
258258
.from(simpleTable)
259259
.where(id, isGreaterThan(2))
260260
.or(occupation, isNull(), and(id, isLessThan(6)))
@@ -283,14 +283,14 @@ an example from ```examples.simple.SimpleTableXmlMapperTest```:
283283
try {
284284
SimpleTableXmlMapper mapper = session.getMapper(SimpleTableXmlMapper.class);
285285

286-
SelectSupport selectSupport = select(id.as("A_ID"), firstName, lastName, birthDate, employed, occupation)
286+
SelectProvider selectProvider = select(id.as("A_ID"), firstName, lastName, birthDate, employed, occupation)
287287
.from(simpleTable)
288288
.where(id, isEqualTo(1))
289289
.or(occupation, isNull())
290290
.build()
291291
.render(RenderingStrategy.MYBATIS3);
292292

293-
List<SimpleTableRecord> rows = mapper.selectMany(selectSupport);
293+
List<SimpleTableRecord> rows = mapper.selectMany(selectProvider);
294294

295295
assertThat(rows.size()).isEqualTo(3);
296296
} finally {

src/main/java/org/mybatis/dynamic/sql/AbstractSqlSupport.java src/main/java/org/mybatis/dynamic/sql/AbstractSqlProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import java.util.Objects;
1919

20-
public abstract class AbstractSqlSupport {
20+
public abstract class AbstractSqlProvider {
2121
private String tableName;
2222

23-
public AbstractSqlSupport(String tableName) {
23+
public AbstractSqlProvider(String tableName) {
2424
this.tableName = Objects.requireNonNull(tableName);
2525
}
2626

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ private DeleteDSL(SqlTable table) {
2929
this.table = table;
3030
}
3131

32-
public <T> DeleteSupportWhereBuilder where(SqlColumn<T> column, VisitableCondition<T> condition) {
33-
return new DeleteSupportWhereBuilder(column, condition);
32+
public <T> DeleteWhereBuilder where(SqlColumn<T> column, VisitableCondition<T> condition) {
33+
return new DeleteWhereBuilder(column, condition);
3434
}
3535

36-
public <T> DeleteSupportWhereBuilder where(SqlColumn<T> column, VisitableCondition<T> condition,
36+
public <T> DeleteWhereBuilder where(SqlColumn<T> column, VisitableCondition<T> condition,
3737
SqlCriterion<?>...subCriteria) {
38-
return new DeleteSupportWhereBuilder(column, condition, subCriteria);
38+
return new DeleteWhereBuilder(column, condition, subCriteria);
3939
}
4040

4141
/**
@@ -54,13 +54,13 @@ public static DeleteDSL deleteFrom(SqlTable table) {
5454
return new DeleteDSL(table);
5555
}
5656

57-
public class DeleteSupportWhereBuilder extends AbstractWhereDSL<DeleteSupportWhereBuilder> {
57+
public class DeleteWhereBuilder extends AbstractWhereDSL<DeleteWhereBuilder> {
5858

59-
private <T> DeleteSupportWhereBuilder(SqlColumn<T> column, VisitableCondition<T> condition) {
59+
private <T> DeleteWhereBuilder(SqlColumn<T> column, VisitableCondition<T> condition) {
6060
super(column, condition);
6161
}
6262

63-
private <T> DeleteSupportWhereBuilder(SqlColumn<T> column, VisitableCondition<T> condition,
63+
private <T> DeleteWhereBuilder(SqlColumn<T> column, VisitableCondition<T> condition,
6464
SqlCriterion<?>...subCriteria) {
6565
super(column, condition, subCriteria);
6666
}
@@ -73,7 +73,7 @@ public DeleteModel build() {
7373
}
7474

7575
@Override
76-
protected DeleteSupportWhereBuilder getThis() {
76+
protected DeleteWhereBuilder getThis() {
7777
return this;
7878
}
7979
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import java.util.Optional;
2020

2121
import org.mybatis.dynamic.sql.SqlTable;
22+
import org.mybatis.dynamic.sql.delete.render.DeleteProvider;
2223
import org.mybatis.dynamic.sql.delete.render.DeleteRenderer;
23-
import org.mybatis.dynamic.sql.delete.render.DeleteSupport;
2424
import org.mybatis.dynamic.sql.render.RenderingStrategy;
2525
import org.mybatis.dynamic.sql.where.WhereModel;
2626

@@ -41,7 +41,7 @@ public Optional<WhereModel> whereModel() {
4141
return whereModel;
4242
}
4343

44-
public DeleteSupport render(RenderingStrategy renderingStrategy) {
44+
public DeleteProvider render(RenderingStrategy renderingStrategy) {
4545
return new DeleteRenderer.Builder()
4646
.withDeleteModel(this)
4747
.withRenderingStrategy(renderingStrategy)

src/main/java/org/mybatis/dynamic/sql/delete/render/DeleteSupport.java src/main/java/org/mybatis/dynamic/sql/delete/render/DeleteProvider.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import java.util.Objects;
2424
import java.util.Optional;
2525

26-
import org.mybatis.dynamic.sql.AbstractSqlSupport;
27-
import org.mybatis.dynamic.sql.where.render.WhereSupport;
26+
import org.mybatis.dynamic.sql.AbstractSqlProvider;
27+
import org.mybatis.dynamic.sql.where.render.WhereProvider;
2828

29-
public class DeleteSupport extends AbstractSqlSupport {
29+
public class DeleteProvider extends AbstractSqlProvider {
3030
private Optional<String> whereClause;
3131
private Map<String, Object> parameters;
3232

33-
private DeleteSupport(Builder builder) {
33+
private DeleteProvider(Builder builder) {
3434
super(builder.tableName);
3535
whereClause = Objects.requireNonNull(builder.whereClause);
3636
parameters = Objects.requireNonNull(builder.parameters);
@@ -56,14 +56,14 @@ public Builder withTableName(String tableName) {
5656
return this;
5757
}
5858

59-
public Builder withWhereSupport(Optional<WhereSupport> whereSupport) {
60-
whereClause = whereSupport.map(WhereSupport::getWhereClause);
61-
parameters.putAll(whereSupport.map(WhereSupport::getParameters).orElse(Collections.emptyMap()));
59+
public Builder withWhereProvider(Optional<WhereProvider> whereProvider) {
60+
whereClause = whereProvider.map(WhereProvider::getWhereClause);
61+
parameters.putAll(whereProvider.map(WhereProvider::getParameters).orElse(Collections.emptyMap()));
6262
return this;
6363
}
6464

65-
public DeleteSupport build() {
66-
return new DeleteSupport(this);
65+
public DeleteProvider build() {
66+
return new DeleteProvider(this);
6767
}
6868
}
6969
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import org.mybatis.dynamic.sql.render.RenderingStrategy;
2323
import org.mybatis.dynamic.sql.render.TableAliasCalculator;
2424
import org.mybatis.dynamic.sql.where.WhereModel;
25+
import org.mybatis.dynamic.sql.where.render.WhereProvider;
2526
import org.mybatis.dynamic.sql.where.render.WhereRenderer;
26-
import org.mybatis.dynamic.sql.where.render.WhereSupport;
2727

2828
public class DeleteRenderer {
2929
private DeleteModel deleteModel;
@@ -34,14 +34,14 @@ private DeleteRenderer(Builder builder) {
3434
renderingStrategy = Objects.requireNonNull(builder.renderingStrategy);
3535
}
3636

37-
public DeleteSupport render() {
38-
return new DeleteSupport.Builder()
37+
public DeleteProvider render() {
38+
return new DeleteProvider.Builder()
3939
.withTableName(deleteModel.table().name())
40-
.withWhereSupport(deleteModel.whereModel().map(this::renderWhereModel))
40+
.withWhereProvider(deleteModel.whereModel().map(this::renderWhereModel))
4141
.build();
4242
}
4343

44-
private WhereSupport renderWhereModel(WhereModel whereModel) {
44+
private WhereProvider renderWhereModel(WhereModel whereModel) {
4545
return new WhereRenderer.Builder()
4646
.withWhereModel(whereModel)
4747
.withRenderingStrategy(renderingStrategy)

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

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

2525
import org.mybatis.dynamic.sql.SqlTable;
26+
import org.mybatis.dynamic.sql.insert.render.InsertBatchProvider;
2627
import org.mybatis.dynamic.sql.insert.render.InsertBatchRenderer;
27-
import org.mybatis.dynamic.sql.insert.render.InsertBatchSupport;
2828
import org.mybatis.dynamic.sql.render.RenderingStrategy;
2929
import org.mybatis.dynamic.sql.util.InsertMapping;
3030

@@ -51,7 +51,7 @@ public SqlTable table() {
5151
return table;
5252
}
5353

54-
public InsertBatchSupport<T> render(RenderingStrategy renderingStrategy) {
54+
public InsertBatchProvider<T> render(RenderingStrategy renderingStrategy) {
5555
return new InsertBatchRenderer.Builder<T>()
5656
.withInsertBatchModel(this)
5757
.withRenderingStrategy(renderingStrategy)

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

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

2424
import org.mybatis.dynamic.sql.SqlTable;
25+
import org.mybatis.dynamic.sql.insert.render.InsertProvider;
2526
import org.mybatis.dynamic.sql.insert.render.InsertRenderer;
26-
import org.mybatis.dynamic.sql.insert.render.InsertSupport;
2727
import org.mybatis.dynamic.sql.render.RenderingStrategy;
2828
import org.mybatis.dynamic.sql.util.InsertMapping;
2929

@@ -50,7 +50,7 @@ public SqlTable table() {
5050
return table;
5151
}
5252

53-
public InsertSupport<T> render(RenderingStrategy renderingStrategy) {
53+
public InsertProvider<T> render(RenderingStrategy renderingStrategy) {
5454
return new InsertRenderer.Builder<T>()
5555
.withInsertModel(this)
5656
.withRenderingStrategy(renderingStrategy)

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
import org.mybatis.dynamic.sql.SqlColumn;
2525
import org.mybatis.dynamic.sql.SqlTable;
26+
import org.mybatis.dynamic.sql.insert.render.InsertSelectProvider;
2627
import org.mybatis.dynamic.sql.insert.render.InsertSelectRenderer;
27-
import org.mybatis.dynamic.sql.insert.render.InsertSelectSupport;
2828
import org.mybatis.dynamic.sql.render.RenderingStrategy;
2929
import org.mybatis.dynamic.sql.select.SelectModel;
3030

@@ -51,7 +51,7 @@ public <R> Optional<Stream<R>> mapColumns(Function<SqlColumn<?>, R> mapper) {
5151
return columns.map(cl -> cl.stream().map(mapper));
5252
}
5353

54-
public InsertSelectSupport render(RenderingStrategy renderingStrategy) {
54+
public InsertSelectProvider render(RenderingStrategy renderingStrategy) {
5555
return new InsertSelectRenderer.Builder()
5656
.withInsertSelectModel(this)
5757
.withRenderingStrategy(renderingStrategy)

src/main/java/org/mybatis/dynamic/sql/insert/render/InsertBatchSupport.java src/main/java/org/mybatis/dynamic/sql/insert/render/InsertBatchProvider.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@
2121
import java.util.Objects;
2222
import java.util.stream.Collectors;
2323

24-
import org.mybatis.dynamic.sql.AbstractSqlSupport;
24+
import org.mybatis.dynamic.sql.AbstractSqlProvider;
2525

26-
public class InsertBatchSupport<T> extends AbstractSqlSupport {
26+
public class InsertBatchProvider<T> extends AbstractSqlProvider {
2727

2828
private String columnsPhrase;
2929
private String valuesPhrase;
3030
private List<T> records;
3131

32-
private InsertBatchSupport(Builder<T> builder) {
32+
private InsertBatchProvider(Builder<T> builder) {
3333
super(builder.tableName);
3434
this.columnsPhrase = Objects.requireNonNull(builder.columnsPhrase);
3535
this.valuesPhrase = Objects.requireNonNull(builder.valuesPhrase);
3636
this.records = Collections.unmodifiableList(Objects.requireNonNull(builder.records));
3737
}
3838

39-
public List<InsertSupport<T>> insertSupports() {
39+
public List<InsertProvider<T>> insertProviders() {
4040
return records.stream()
41-
.map(this::toInsertSupport)
41+
.map(this::toInsertProvider)
4242
.collect(Collectors.toList());
4343
}
4444

45-
private InsertSupport<T> toInsertSupport(T record) {
46-
return new InsertSupport.Builder<T>()
45+
private InsertProvider<T> toInsertProvider(T record) {
46+
return new InsertProvider.Builder<T>()
4747
.withTableName(super.tableName())
4848
.withColumnsPhrase(columnsPhrase)
4949
.withValuesPhrase(valuesPhrase)
@@ -77,8 +77,8 @@ public Builder<T> withRecords(List<T> records) {
7777
return this;
7878
}
7979

80-
public InsertBatchSupport<T> build() {
81-
return new InsertBatchSupport<>(this);
80+
public InsertBatchProvider<T> build() {
81+
return new InsertBatchProvider<>(this);
8282
}
8383
}
8484
}

src/main/java/org/mybatis/dynamic/sql/insert/render/InsertBatchRenderer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ private InsertBatchRenderer(Builder<T> builder) {
3232
renderingStrategy = Objects.requireNonNull(builder.renderingStrategy);
3333
}
3434

35-
public InsertBatchSupport<T> render() {
35+
public InsertBatchProvider<T> render() {
3636
ValuePhraseVisitor visitor = new ValuePhraseVisitor(renderingStrategy);
3737
FieldAndValueCollector<T> collector = model.mapColumnMappings(toFieldAndValue(visitor))
3838
.collect(FieldAndValueCollector.collect());
39-
return new InsertBatchSupport.Builder<T>()
39+
return new InsertBatchProvider.Builder<T>()
4040
.withTableName(model.table().name())
4141
.withColumnsPhrase(collector.columnsPhrase())
4242
.withValuesPhrase(collector.valuesPhrase())

src/main/java/org/mybatis/dynamic/sql/insert/render/InsertSupport.java src/main/java/org/mybatis/dynamic/sql/insert/render/InsertProvider.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
import java.util.Objects;
2121

22-
import org.mybatis.dynamic.sql.AbstractSqlSupport;
22+
import org.mybatis.dynamic.sql.AbstractSqlProvider;
2323

24-
public class InsertSupport<T> extends AbstractSqlSupport {
24+
public class InsertProvider<T> extends AbstractSqlProvider {
2525

2626
private String columnsPhrase;
2727
private String valuesPhrase;
2828
private T record;
2929

30-
private InsertSupport(Builder<T> builder) {
30+
private InsertProvider(Builder<T> builder) {
3131
super(builder.tableName);
3232
this.columnsPhrase = Objects.requireNonNull(builder.columnsPhrase);
3333
this.valuesPhrase = Objects.requireNonNull(builder.valuesPhrase);
@@ -71,8 +71,8 @@ public Builder<T> withRecord(T record) {
7171
return this;
7272
}
7373

74-
public InsertSupport<T> build() {
75-
return new InsertSupport<>(this);
74+
public InsertProvider<T> build() {
75+
return new InsertProvider<>(this);
7676
}
7777
}
7878
}

0 commit comments

Comments
 (0)