本文整理了Java中org.jdbi.v3.core.Handle.getExtensionMethod()
方法的一些代码示例,展示了Handle.getExtensionMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handle.getExtensionMethod()
方法的具体详情如下:
包路径:org.jdbi.v3.core.Handle
类名称:Handle
方法名:getExtensionMethod
暂无
代码示例来源:origin: jdbi/jdbi
BaseStatement(Handle handle) {
this.handle = handle;
this.ctx = new StatementContext(handle.getConfig().createCopy(), handle.getExtensionMethod());
// Prevent bogus signatures like Update extends SqlStatement<Query>
// SqlStatement's generic parameter must be supertype of getClass()
if (GenericTypes.findGenericParameter(getClass(), BaseStatement.class)
.map(GenericTypes::getErasedType)
.map(type -> !type.isAssignableFrom(getClass()))
.orElse(false)) { // subclass is raw type.. ¯\_(ツ)_/¯
throw new IllegalStateException("inconsistent SqlStatement hierarchy");
}
}
代码示例来源:origin: jdbi/jdbi
@Override
public <V> V invokeInContext(ExtensionMethod extensionMethod, ConfigRegistry config, Callable<V> task) throws Exception {
ExtensionMethod oldExtensionMethod = handle.getExtensionMethod();
try {
handle.setExtensionMethod(extensionMethod);
ConfigRegistry oldConfig = handle.getConfig();
try {
handle.setConfig(config);
return task.call();
} finally {
handle.setConfig(oldConfig);
}
} finally {
handle.setExtensionMethod(oldExtensionMethod);
}
}
}
代码示例来源:origin: jdbi/jdbi
default void check() throws Exception {
Class<StatementContextExtensionMethodDao> extensionMethodDaoClass = StatementContextExtensionMethodDao.class;
Method checkMethod = extensionMethodDaoClass.getMethod("check");
ExtensionMethod extensionMethod = getHandle().getExtensionMethod();
assertThat(extensionMethod.getType()).isEqualTo(extensionMethodDaoClass);
assertThat(extensionMethod.getMethod()).isEqualTo(checkMethod);
extensionMethod = getHandle().createQuery("select * from something").getContext().getExtensionMethod();
assertThat(extensionMethod.getType()).isEqualTo(extensionMethodDaoClass);
assertThat(extensionMethod.getMethod()).isEqualTo(checkMethod);
}
}
代码示例来源:origin: org.jdbi/jdbi3
BaseStatement(Handle handle)
{
this.handle = handle;
this.ctx = new StatementContext(
handle.getConfig().createCopy(), handle.getExtensionMethod());
}
代码示例来源:origin: org.jdbi/jdbi3
@Override
public <V> V invokeInContext(ExtensionMethod extensionMethod, ConfigRegistry config, Callable<V> task) throws Exception {
ExtensionMethod oldExtensionMethod = handle.getExtensionMethod();
try {
handle.setExtensionMethod(extensionMethod);
ConfigRegistry oldConfig = handle.getConfig();
try {
handle.setConfig(config);
return task.call();
}
finally {
handle.setConfig(oldConfig);
}
}
finally {
handle.setExtensionMethod(oldExtensionMethod);
}
}
}
代码示例来源:origin: org.jdbi/jdbi3-sqlobject
default void check() throws Exception {
Class<StatementContextExtensionMethodDao> extensionMethodDaoClass = StatementContextExtensionMethodDao.class;
Method checkMethod = extensionMethodDaoClass.getMethod("check");
ExtensionMethod extensionMethod = getHandle().getExtensionMethod();
assertThat(extensionMethod.getType()).isEqualTo(extensionMethodDaoClass);
assertThat(extensionMethod.getMethod()).isEqualTo(checkMethod);
extensionMethod = getHandle().createQuery("select * from something").getContext().getExtensionMethod();
assertThat(extensionMethod.getType()).isEqualTo(extensionMethodDaoClass);
assertThat(extensionMethod.getMethod()).isEqualTo(checkMethod);
}
}
内容来源于网络,如有侵权,请联系作者删除!