io.github.nichetoolkit.mybatis.MybatisSqlSourceProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis-toolkit-context Show documentation
Show all versions of mybatis-toolkit-context Show documentation
Mybatis toolkit context project for Spring Boot
The newest version!
package io.github.nichetoolkit.mybatis;
import org.apache.ibatis.builder.annotation.ProviderContext;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;
import org.springframework.core.io.support.SpringFactoriesLoader;
import java.util.List;
/**
* MybatisSqlSourceProvider
* The mybatis sql source provider interface.
* @author Cyan ([email protected])
* @see io.github.nichetoolkit.mybatis.MybatisOrder
* @since Jdk1.8
*/
public interface MybatisSqlSourceProvider extends MybatisOrder {
/**
* ofProvide
* The of provide method.
* @param sqlSource {@link org.apache.ibatis.mapping.SqlSource} The sql source parameter is SqlSource
type.
* @param table {@link io.github.nichetoolkit.mybatis.MybatisTable} The table parameter is MybatisTable
type.
* @param statement {@link org.apache.ibatis.mapping.MappedStatement} The statement parameter is MappedStatement
type.
* @param context {@link org.apache.ibatis.builder.annotation.ProviderContext} The context parameter is ProviderContext
type.
* @return {@link org.apache.ibatis.mapping.SqlSource} The of provide return object is SqlSource
type.
* @see org.apache.ibatis.mapping.SqlSource
* @see io.github.nichetoolkit.mybatis.MybatisTable
* @see org.apache.ibatis.mapping.MappedStatement
* @see org.apache.ibatis.builder.annotation.ProviderContext
*/
static SqlSource ofProvide(SqlSource sqlSource, MybatisTable table, MappedStatement statement, ProviderContext context) {
for (MybatisSqlSourceProvider provider : Instance.sqlSourceProviders()) {
sqlSource = provider.provide(sqlSource, table, statement, context);
}
return sqlSource;
}
/**
* provide
* The provide method.
* @param sqlSource {@link org.apache.ibatis.mapping.SqlSource} The sql source parameter is SqlSource
type.
* @param table {@link io.github.nichetoolkit.mybatis.MybatisTable} The table parameter is MybatisTable
type.
* @param statement {@link org.apache.ibatis.mapping.MappedStatement} The statement parameter is MappedStatement
type.
* @param context {@link org.apache.ibatis.builder.annotation.ProviderContext} The context parameter is ProviderContext
type.
* @return {@link org.apache.ibatis.mapping.SqlSource} The provide return object is SqlSource
type.
* @see org.apache.ibatis.mapping.SqlSource
* @see io.github.nichetoolkit.mybatis.MybatisTable
* @see org.apache.ibatis.mapping.MappedStatement
* @see org.apache.ibatis.builder.annotation.ProviderContext
*/
SqlSource provide(SqlSource sqlSource, MybatisTable table, MappedStatement statement, ProviderContext context);
/**
* Instance
* The instance class.
* @author Cyan ([email protected])
* @since Jdk1.8
*/
class Instance {
/**
* SQL_SOURCE_PROVIDERS
* {@link java.util.List} The SQL_SOURCE_PROVIDERS
field.
* @see java.util.List
*/
private static List SQL_SOURCE_PROVIDERS;
/**
* sqlSourceProviders
* The sql source providers method.
* @return {@link java.util.List} The sql source providers return object is List
type.
* @see java.util.List
*/
public static List sqlSourceProviders() {
if (SQL_SOURCE_PROVIDERS == null) {
SQL_SOURCE_PROVIDERS = SpringFactoriesLoader.loadFactories(MybatisSqlSourceProvider.class, null);
}
return SQL_SOURCE_PROVIDERS;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy