Skip to content

Commit 049a8d9

Browse files
committed
Better names for helper interfaces
1 parent 79c6f60 commit 049a8d9

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3CountByExampleSupport.java renamed to src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3CountByExampleHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
import org.mybatis.dynamic.sql.util.Buildable;
2323

2424
@FunctionalInterface
25-
public interface MyBatis3CountByExampleSupport extends
25+
public interface MyBatis3CountByExampleHelper extends
2626
Function<QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>>, Buildable<MyBatis3SelectModelAdapter<Long>>> {
2727
}

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3DeleteByExampleSupport.java renamed to src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3DeleteByExampleHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
*
3131
*/
3232
@FunctionalInterface
33-
public interface MyBatis3DeleteByExampleSupport extends
33+
public interface MyBatis3DeleteByExampleHelper extends
3434
Function<DeleteDSL<MyBatis3DeleteModelAdapter<Integer>>, Buildable<MyBatis3DeleteModelAdapter<Integer>>> {
3535
}

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3SelectByExampleSupport.java renamed to src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3SelectByExampleHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.mybatis.dynamic.sql.util.Buildable;
2424

2525
@FunctionalInterface
26-
public interface MyBatis3SelectByExampleSupport<T> extends
26+
public interface MyBatis3SelectByExampleHelper<T> extends
2727
Function<QueryExpressionDSL<MyBatis3SelectModelAdapter<List<T>>>,
2828
Buildable<MyBatis3SelectModelAdapter<List<T>>>> {
2929
}

src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3UpdateByExampleSupport.java renamed to src/main/java/org/mybatis/dynamic/sql/util/mybatis3/MyBatis3UpdateByExampleHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
import org.mybatis.dynamic.sql.util.Buildable;
2323

2424
@FunctionalInterface
25-
public interface MyBatis3UpdateByExampleSupport extends
25+
public interface MyBatis3UpdateByExampleHelper extends
2626
Function<UpdateDSL<MyBatis3UpdateModelAdapter<Integer>>, Buildable<MyBatis3UpdateModelAdapter<Integer>>> {
2727
}

src/test/java/examples/simple/SimpleTableAnnotatedMapperNewStyle.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
import org.mybatis.dynamic.sql.update.UpdateDSL;
4242
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
4343
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
44-
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3CountByExampleSupport;
45-
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3DeleteByExampleSupport;
46-
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3SelectByExampleSupport;
47-
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3UpdateByExampleSupport;
44+
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3CountByExampleHelper;
45+
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3DeleteByExampleHelper;
46+
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3SelectByExampleHelper;
47+
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3UpdateByExampleHelper;
4848

4949
/**
5050
*
@@ -89,15 +89,15 @@ public interface SimpleTableAnnotatedMapperNewStyle {
8989
@SelectProvider(type=SqlProviderAdapter.class, method="select")
9090
long count(SelectStatementProvider selectStatement);
9191

92-
default long countByExample(MyBatis3CountByExampleSupport whereBuilder) {
93-
return whereBuilder.apply(SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
92+
default long countByExample(MyBatis3CountByExampleHelper helper) {
93+
return helper.apply(SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
9494
.from(simpleTable))
9595
.build()
9696
.execute();
9797
}
9898

99-
default int deleteByExample(MyBatis3DeleteByExampleSupport whereBuilder) {
100-
return whereBuilder.apply(DeleteDSL.deleteFromWithMapper(this::delete, simpleTable))
99+
default int deleteByExample(MyBatis3DeleteByExampleHelper helper) {
100+
return helper.apply(DeleteDSL.deleteFromWithMapper(this::delete, simpleTable))
101101
.build()
102102
.execute();
103103
}
@@ -148,15 +148,15 @@ default int insertSelective(SimpleTableRecord record) {
148148
.render(RenderingStrategy.MYBATIS3));
149149
}
150150

151-
default List<SimpleTableRecord> selectByExample(MyBatis3SelectByExampleSupport<SimpleTableRecord> whereBuilder) {
152-
return whereBuilder.apply(SelectDSL.selectWithMapper(this::selectMany, id.as("A_ID"), firstName, lastName, birthDate, employed, occupation)
151+
default List<SimpleTableRecord> selectByExample(MyBatis3SelectByExampleHelper<SimpleTableRecord> helper) {
152+
return helper.apply(SelectDSL.selectWithMapper(this::selectMany, id.as("A_ID"), firstName, lastName, birthDate, employed, occupation)
153153
.from(simpleTable))
154154
.build()
155155
.execute();
156156
}
157157

158-
default List<SimpleTableRecord> selectDistinctByExample(MyBatis3SelectByExampleSupport<SimpleTableRecord> whereBuilder) {
159-
return whereBuilder.apply(SelectDSL.selectDistinctWithMapper(this::selectMany, id.as("A_ID"), firstName, lastName, birthDate, employed, occupation)
158+
default List<SimpleTableRecord> selectDistinctByExample(MyBatis3SelectByExampleHelper<SimpleTableRecord> helper) {
159+
return helper.apply(SelectDSL.selectDistinctWithMapper(this::selectMany, id.as("A_ID"), firstName, lastName, birthDate, employed, occupation)
160160
.from(simpleTable))
161161
.build()
162162
.execute();
@@ -170,8 +170,8 @@ default SimpleTableRecord selectByPrimaryKey(Integer id_) {
170170
.execute();
171171
}
172172

173-
default int updateByExample(SimpleTableRecord record, MyBatis3UpdateByExampleSupport whereBuilder) {
174-
return whereBuilder.apply(UpdateDSL.updateWithMapper(this::update, simpleTable)
173+
default int updateByExample(SimpleTableRecord record, MyBatis3UpdateByExampleHelper helper) {
174+
return helper.apply(UpdateDSL.updateWithMapper(this::update, simpleTable)
175175
.set(id).equalTo(record.getId())
176176
.set(firstName).equalTo(record::getFirstName)
177177
.set(lastName).equalTo(record::getLastName)
@@ -182,8 +182,8 @@ default int updateByExample(SimpleTableRecord record, MyBatis3UpdateByExampleSup
182182
.execute();
183183
}
184184

185-
default int updateByExampleSelective(SimpleTableRecord record, MyBatis3UpdateByExampleSupport whereBuilder) {
186-
return whereBuilder.apply(UpdateDSL.updateWithMapper(this::update, simpleTable)
185+
default int updateByExampleSelective(SimpleTableRecord record, MyBatis3UpdateByExampleHelper helper) {
186+
return helper.apply(UpdateDSL.updateWithMapper(this::update, simpleTable)
187187
.set(id).equalToWhenPresent(record.getId())
188188
.set(firstName).equalToWhenPresent(record::getFirstName)
189189
.set(lastName).equalToWhenPresent(record::getLastName)

0 commit comments

Comments
 (0)