Skip to content

Commit

Permalink
Merge pull request #691 from hazendaz/master
Browse files Browse the repository at this point in the history
[ci] Minor formatting / import sorting
  • Loading branch information
hazendaz authored Nov 8, 2023
2 parents b1981b4 + 0b39d9b commit 93ac6d6
Show file tree
Hide file tree
Showing 33 changed files with 54 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
import java.util.function.Predicate;
import java.util.function.Supplier;

public abstract class AbstractTwoValueCondition<T>
implements VisitableCondition<T> {
public abstract class AbstractTwoValueCondition<T> implements VisitableCondition<T> {
protected final T value1;
protected final T value2;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/mybatis/dynamic/sql/CriteriaGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* as in an expression like ((A &lt; 5 and B &gt; 6) or C = 3)
*
* @author Jeff Butler, inspired by @JoshuaJeme
*
* @since 1.4.0
*/
public class CriteriaGroup extends SqlCriterion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
* </dl>
*
* @see GlobalConfiguration
*
* @since 1.4.1
*
* @author Jeff Butler
*/
public class StatementConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public DeleteDSL<R> configureStatement(Consumer<StatementConfiguration> consumer
}

public static <R> DeleteDSL<R> deleteFrom(Function<DeleteModel, R> adapterFunction, SqlTable table,
String tableAlias) {
String tableAlias) {
return new DeleteDSL<>(table, tableAlias, adapterFunction);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected Add<T> copy() {
}

public static <T> Add<T> of(BindableColumn<T> firstColumn, BasicColumn secondColumn,
BasicColumn... subsequentColumns) {
BasicColumn... subsequentColumns) {
return of(firstColumn, secondColumn, Arrays.asList(subsequentColumns));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static <T> Concatenate<T> concatenate(BindableColumn<T> firstColumn, Basi
}

public static <T> Concatenate<T> of(BindableColumn<T> firstColumn, BasicColumn secondColumn,
List<BasicColumn> subsequentColumns) {
List<BasicColumn> subsequentColumns) {
return new Concatenate<>(firstColumn, secondColumn, subsequentColumns);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected Divide<T> copy() {
}

public static <T> Divide<T> of(BindableColumn<T> firstColumn, BasicColumn secondColumn,
BasicColumn... subsequentColumns) {
BasicColumn... subsequentColumns) {
return of(firstColumn, secondColumn, Arrays.asList(subsequentColumns));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected Multiply<T> copy() {
}

public static <T> Multiply<T> of(BindableColumn<T> firstColumn, BasicColumn secondColumn,
BasicColumn... subsequentColumns) {
BasicColumn... subsequentColumns) {
return of(firstColumn, secondColumn, Arrays.asList(subsequentColumns));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static <T> OperatorFunction<T> of(String operator, BindableColumn<T> firs
}

public static <T> OperatorFunction<T> of(String operator, BindableColumn<T> firstColumn, BasicColumn secondColumn,
List<BasicColumn> subsequentColumns) {
List<BasicColumn> subsequentColumns) {
return new OperatorFunction<>(operator, firstColumn, secondColumn, subsequentColumns);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class WhereModel extends AbstractBooleanExpressionModel {
private final StatementConfiguration statementConfiguration;

public WhereModel(SqlCriterion initialCriterion, List<AndOrCriteriaGroup> subCriteria,
StatementConfiguration statementConfiguration) {
StatementConfiguration statementConfiguration) {
super(initialCriterion, subCriteria);
this.statementConfiguration = Objects.requireNonNull(statementConfiguration);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IsLessThanOrEqualTo<T> filter(Predicate<? super T> predicate) {

/**
* If renderable, apply the mapping to the value and return a new condition with the new value. Else return a
* condition that will not render (this).
* condition that will not render (this).
*
* @param mapper a mapping function to apply to the value, if renderable
* @param <R> type of the new condition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IsLike<T> filter(Predicate<? super T> predicate) {

/**
* If renderable, apply the mapping to the value and return a new condition with the new value. Else return a
* condition that will not render (this).
* condition that will not render (this).
*
* @param mapper a mapping function to apply to the value, if renderable
* @param <R> type of the new condition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public IsLikeCaseInsensitive filter(Predicate<? super String> predicate) {

/**
* If renderable, apply the mapping to the value and return a new condition with the new value. Else return a
* condition that will not render (this).
* condition that will not render (this).
*
* @param mapper a mapping function to apply to the value, if renderable
* @return a new condition with the result of applying the mapper to the value of this condition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public IsNotBetween<T> filter(Predicate<? super T> predicate) {

/**
* If renderable, apply the mappings to the values and return a new condition with the new values. Else return a
* condition that will not render (this).
* condition that will not render (this).
*
* @param mapper1 a mapping function to apply to the first value, if renderable
* @param mapper2 a mapping function to apply to the second value, if renderable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public IsNotEqualTo<T> filter(Predicate<? super T> predicate) {

/**
* If renderable, apply the mapping to the value and return a new condition with the new value. Else return a
* condition that will not render (this).
* condition that will not render (this).
*
* @param mapper a mapping function to apply to the value, if renderable
* @param <R> type of the new condition
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/examples/animal/data/AnimalDataMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public interface AnimalDataMapper extends CommonDeleteMapper, CommonInsertMapper
})
List<AnimalData> selectMany(SelectStatementProvider selectStatement);

@SelectProvider(type=SqlProviderAdapter.class, method="select")
@SelectProvider(type = SqlProviderAdapter.class, method = "select")
@ResultMap("AnimalDataResult")
List<AnimalData> selectManyWithRowBounds(SelectStatementProvider selectStatement, RowBounds rowBounds);

@SelectProvider(type=SqlProviderAdapter.class, method="select")
@SelectProvider(type = SqlProviderAdapter.class, method = "select")
@ResultMap("AnimalDataResult")
AnimalData selectOne(SelectStatementProvider selectStatement);

Expand Down Expand Up @@ -75,7 +75,7 @@ public interface AnimalDataMapper extends CommonDeleteMapper, CommonInsertMapper
})
@ResultMap("AnimalDataResult")
List<AnimalData> selectWithWhereClauseLimitAndOffset(@Param("whereClauseProvider") WhereClauseProvider whereClause,
@Param("limit") int limit, @Param("offset") int offset);
@Param("limit") int limit, @Param("offset") int offset);

@Select({
"select b.id, b.animal_name, b.brain_weight, b.body_weight",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package examples.generated.always.mybatis;

import static examples.generated.always.mybatis.GeneratedAlwaysDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import java.util.Arrays;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.Buildable;
import org.mybatis.dynamic.sql.util.spring.NamedParameterJdbcTemplateExtensions;
import org.mybatis.dynamic.sql.util.spring.BatchInsertUtility;
import org.mybatis.dynamic.sql.util.spring.NamedParameterJdbcTemplateExtensions;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/examples/mariadb/ItemsDynamicSQLSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package examples.mariadb;

import java.sql.JDBCType;

import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;

import java.sql.JDBCType;

public final class ItemsDynamicSQLSupport {
public static final Items items = new Items();
public static final SqlColumn<Integer> id = items.id;
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/examples/mariadb/MariaDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
import static org.assertj.core.api.Assertions.entry;
import static org.mybatis.dynamic.sql.SqlBuilder.add;
import static org.mybatis.dynamic.sql.SqlBuilder.constant;
import static org.mybatis.dynamic.sql.SqlBuilder.isLessThan;
import static org.mybatis.dynamic.sql.SqlBuilder.deleteFrom;
import static org.mybatis.dynamic.sql.SqlBuilder.isLessThan;
import static org.mybatis.dynamic.sql.SqlBuilder.select;
import static org.mybatis.dynamic.sql.SqlBuilder.update;

import config.TestContainersConfiguration;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
Expand All @@ -50,8 +53,6 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import java.util.List;
import java.util.Map;

@Testcontainers
class MariaDBTest {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/examples/sharding/ShardingTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,7 +51,6 @@ class ShardingTest {

private SqlSessionFactory sqlSessionFactory;


@BeforeEach
void setup() throws Exception {
Class.forName(JDBC_DRIVER);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,11 +15,11 @@
*/
package examples.sharding;

import java.sql.JDBCType;

import org.mybatis.dynamic.sql.AliasableSqlTable;
import org.mybatis.dynamic.sql.SqlColumn;

import java.sql.JDBCType;

public final class TableCodesDynamicSqlSupport {
public static final TableCodes tableCodes = new TableCodes();
public static final SqlColumn<Integer> id = tableCodes.id;
Expand All @@ -28,6 +28,7 @@ public final class TableCodesDynamicSqlSupport {
public static final class TableCodes extends AliasableSqlTable<TableCodes> {
public final SqlColumn<Integer> id = column("id", JDBCType.INTEGER);
public final SqlColumn<String> description = column("description", JDBCType.VARCHAR);

public TableCodes() {
super("tableCodes_even", TableCodes::new);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package examples.simple;

import java.sql.JDBCType;

import org.mybatis.dynamic.sql.SqlColumn;
import org.mybatis.dynamic.sql.SqlTable;

import java.sql.JDBCType;

public class CompoundKeyDynamicSqlSupport {
public static final CompoundKey compoundKey = new CompoundKey();
public static final SqlColumn<Integer> id1 = compoundKey.id1;
Expand Down
18 changes: 9 additions & 9 deletions src/test/java/examples/simple/MyBatisMapToRowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
*/
package examples.simple;

import static examples.simple.CompoundKeyDynamicSqlSupport.compoundKey;
import static examples.simple.CompoundKeyDynamicSqlSupport.id1;
import static examples.simple.CompoundKeyDynamicSqlSupport.id2;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mybatis.dynamic.sql.SqlBuilder.insert;
import static org.mybatis.dynamic.sql.SqlBuilder.insertBatch;
import static org.mybatis.dynamic.sql.SqlBuilder.insertMultiple;
import static org.mybatis.dynamic.sql.SqlBuilder.select;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
Expand Down Expand Up @@ -42,15 +51,6 @@
import org.mybatis.dynamic.sql.render.RenderingStrategies;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;

import static examples.simple.CompoundKeyDynamicSqlSupport.compoundKey;
import static examples.simple.CompoundKeyDynamicSqlSupport.id1;
import static examples.simple.CompoundKeyDynamicSqlSupport.id2;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mybatis.dynamic.sql.SqlBuilder.insert;
import static org.mybatis.dynamic.sql.SqlBuilder.insertBatch;
import static org.mybatis.dynamic.sql.SqlBuilder.insertMultiple;
import static org.mybatis.dynamic.sql.SqlBuilder.select;

class MyBatisMapToRowTest {
private static final String JDBC_URL = "jdbc:hsqldb:mem:aname";
private static final String JDBC_DRIVER = "org.hsqldb.jdbcDriver";
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/examples/simple/PersonMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package examples.simple;

import static examples.simple.PersonDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import java.util.Arrays;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package examples.springbatch.common;

import static examples.springbatch.mapper.PersonDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import org.mybatis.dynamic.sql.render.RenderingStrategies;
import org.mybatis.dynamic.sql.update.UpdateDSL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

import static examples.springbatch.mapper.PersonDynamicSqlSupport.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.count;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package examples.springbatch.paging;

import static examples.springbatch.mapper.PersonDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import javax.sql.DataSource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

import static examples.springbatch.mapper.PersonDynamicSqlSupport.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.count;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/issues/gh100/FromGroupByTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
package issues.gh100;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mybatis.dynamic.sql.SqlBuilder.*;
import static org.mybatis.dynamic.sql.SqlBuilder.count;
import static org.mybatis.dynamic.sql.SqlBuilder.select;

import org.junit.jupiter.api.Test;
import org.mybatis.dynamic.sql.render.RenderingStrategies;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/issues/gh655/Gh655Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import static examples.mariadb.ItemsDynamicSQLSupport.id;
import static examples.mariadb.ItemsDynamicSQLSupport.items;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mybatis.dynamic.sql.SqlBuilder.add;
import static org.mybatis.dynamic.sql.SqlBuilder.constant;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualToWhenPresent;
import static org.mybatis.dynamic.sql.SqlBuilder.isGreaterThan;
import static org.mybatis.dynamic.sql.SqlBuilder.select;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/mybatis/dynamic/sql/InvalidSQLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.Optional;

import org.junit.jupiter.api.Test;
import org.mybatis.dynamic.sql.common.OrderByModel;
import org.mybatis.dynamic.sql.exception.DynamicSqlException;
import org.mybatis.dynamic.sql.exception.InvalidSqlException;
import org.mybatis.dynamic.sql.insert.BatchInsertModel;
Expand All @@ -40,7 +41,6 @@
import org.mybatis.dynamic.sql.render.RenderingStrategies;
import org.mybatis.dynamic.sql.render.TableAliasCalculator;
import org.mybatis.dynamic.sql.select.GroupByModel;
import org.mybatis.dynamic.sql.common.OrderByModel;
import org.mybatis.dynamic.sql.select.PagingModel;
import org.mybatis.dynamic.sql.select.QueryExpressionModel;
import org.mybatis.dynamic.sql.select.SelectModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,3 @@ void testUpdateSelectStatement() {
);
}
}

0 comments on commit 93ac6d6

Please sign in to comment.