本文整理汇总了Java中org.beetl.sql.core.mapper.BaseMapper类的典型用法代码示例。如果您正苦于以下问题:Java BaseMapper类的具体用法?Java BaseMapper怎么用?Java BaseMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseMapper类属于org.beetl.sql.core.mapper包,在下文中一共展示了BaseMapper类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: foundMapper
import org.beetl.sql.core.mapper.BaseMapper; //导入依赖的package包/类
@SubClassFinder(noAbstract = false, callOn = AppEventId.PRE_START)
public void foundMapper(Class<? extends BaseMapper> mapperClass) {
DbServiceManager dbServiceManager = app.dbServiceManager();
try {
Class<?> modelClass = modelClass(mapperClass);
DbService dbService = dbServiceManager.dbService(dbId(modelClass));
if (dbService instanceof BeetlSqlService) {
((BeetlSqlService) dbService).prepareMapperClass(mapperClass, modelClass);
} else {
throw new UnexpectedException("mapper class cannot be landed to a BeetlSqlService");
}
} catch (RuntimeException e) {
LOGGER.warn(e, "Error registering mapping class: %s", mapperClass);
}
}
示例2: modelClass
import org.beetl.sql.core.mapper.BaseMapper; //导入依赖的package包/类
static Class<?> modelClass(Class<? extends BaseMapper> mapperClass) {
List<Type> paramTypes = Generics.typeParamImplementations(mapperClass, BaseMapper.class);
if (paramTypes.size() != 1) {
throw new UnexpectedException("Cannot determine parameter type of %s", mapperClass);
}
Type type = paramTypes.get(0);
if (!(type instanceof Class)) {
throw new UnexpectedException("Cannot determine parameter type of %s", mapperClass);
}
return $.cast(type);
}
示例3: load
import org.beetl.sql.core.mapper.BaseMapper; //导入依赖的package包/类
@Override
public BaseMapper load(BeanSpec beanSpec) {
List<Type> typeList = beanSpec.typeParams();
int sz = typeList.size();
if (sz > 0) {
Class<?> modelType = BeanSpec.rawTypeOf(typeList.get(0));
String dbId = DbServiceManager.dbId(modelType);
DbService service = Act.app().dbServiceManager().dbService(dbId);
if (service instanceof BeetlSqlService) {
BeetlSqlService beetl = $.cast(service);
return beetl.mapper(modelType);
}
}
return null;
}
示例4: prepareMapperClass
import org.beetl.sql.core.mapper.BaseMapper; //导入依赖的package包/类
public void prepareMapperClass(Class<? extends BaseMapper> mapperClass, Class<?> modelClass) {
Object o = Proxy.newProxyInstance(mapperClass.getClassLoader(),
new Class<?>[]{mapperClass},
new MapperJavaProxy(new DefaultMapperBuilder(beetlSql), beetlSql, mapperClass));
final BaseMapper mapper = $.cast(o);
mapperMap.put(mapperClass, mapper);
mapperMap.put(modelClass, mapper);
Genie genie = Act.getInstance(Genie.class);
genie.registerProvider(mapperClass, new Provider() {
@Override
public Object get() {
return mapper;
}
});
}
示例5: configure
import org.beetl.sql.core.mapper.BaseMapper; //导入依赖的package包/类
@Override
protected void configure() {
registerGenericTypedBeanLoader(BaseMapper.class, new MapperLoader());
}
示例6: mapper
import org.beetl.sql.core.mapper.BaseMapper; //导入依赖的package包/类
BaseMapper mapper(Class modelClass) {
return mapperMap.get(modelClass);
}