javax.sql.DataSource.unwrap()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(389)

本文整理了Java中javax.sql.DataSource.unwrap()方法的一些代码示例,展示了DataSource.unwrap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataSource.unwrap()方法的具体详情如下:
包路径:javax.sql.DataSource
类名称:DataSource
方法名:unwrap

DataSource.unwrap介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
  return this.dataSource.unwrap(iface);
}

代码示例来源:origin: looly/hutool

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
  return ds.unwrap(iface);
}

代码示例来源:origin: looly/hutool

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
  return ds.unwrap(iface);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  if (iface.isInstance(this)) {
    return (T) this;
  }
  return obtainTargetDataSource().unwrap(iface);
}

代码示例来源:origin: spring-projects/spring-framework

@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  if (iface.isInstance(this)) {
    return (T) this;
  }
  return determineTargetDataSource().unwrap(iface);
}

代码示例来源:origin: killbill/killbill

@Override
public <T> T unwrap(final Class<T> iface) throws SQLException {
  return delegate.unwrap(iface);
}

代码示例来源:origin: com.zaxxer/HikariCP

/** {@inheritDoc} */
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException
{
 if (iface.isInstance(this)) {
   return (T) this;
 }
 HikariPool p = pool;
 if (p != null) {
   final DataSource unwrappedDataSource = p.getUnwrappedDataSource();
   if (iface.isInstance(unwrappedDataSource)) {
    return (T) unwrappedDataSource;
   }
   if (unwrappedDataSource != null) {
    return unwrappedDataSource.unwrap(iface);
   }
 }
 throw new SQLException("Wrapped DataSource is not an instance of " + iface);
}

代码示例来源:origin: spring-projects/spring-framework

@Test
public void shouldDelegateUnwrapWithoutImplementing() throws Exception {
  ExampleWrapper wrapper = mock(ExampleWrapper.class);
  given(delegate.unwrap(ExampleWrapper.class)).willReturn(wrapper);
  assertThat(dataSource.unwrap(ExampleWrapper.class), is(wrapper));
}

代码示例来源:origin: p6spy/p6spy

/**
 * @param <T>
 * @param iface
 * @return
 * @throws SQLException
 * @see java.sql.Wrapper#unwrap(java.lang.Class)
 */
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
 return rds.unwrap(iface);
}

代码示例来源:origin: ebean-orm/ebean

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
 return dataSource.unwrap(iface);
}

代码示例来源:origin: p6spy/p6spy

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
 return ((DataSource) realDataSource).unwrap(iface);
}

代码示例来源:origin: ebean-orm/ebean

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
 return dataSource.unwrap(iface);
}

代码示例来源:origin: Meituan-Dianping/Zebra

@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  if (iface.isInstance(this)) {
    return (T) this;
  }
  return determineTargetDataSource().unwrap(iface);
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
  return ManagedPoolingDataSource.class.equals(iface) ? (T) this : dataSource.unwrap(iface);
}

代码示例来源:origin: org.apache.cayenne/cayenne-server

@SuppressWarnings("unchecked")
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
  return StoppedDataSource.class.equals(iface) ? (T) this : dataSource.unwrap(iface);
}

代码示例来源:origin: org.eclipse.dirigible/dirigible-database-api

@Override
public <T> T unwrap(Class<T> arg0) throws SQLException {
  logger.debug("called - unwrap(Class<T> arg0)");
  return originalDataSource.unwrap(arg0);
}

代码示例来源:origin: vakinge/jeesuite-libs

@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  if (iface.isInstance(this)) {
    return (T) this;
  }
  return determineTargetDataSource().unwrap(iface);
}

代码示例来源:origin: org.springframework/org.springframework.jdbc

@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  if (iface.isInstance(this)) {
    return (T) this;
  }
  return getTargetDataSource().unwrap(iface);
}

代码示例来源:origin: chenlei2/spring-boot-mybatis-rw

@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) throws SQLException {
  if (iface.isInstance(this)) {
    return (T) this;
  }
  return dataSourceRout.getTargetDataSource().unwrap(iface);
}

代码示例来源:origin: com.caucho/resin

public <T> T unwrap(Class<T> iface) throws SQLException
{
 if (iface.isAssignableFrom(this.getClass()))
  return (T) this;
 else if (_dataSource == null)
  throw new SQLException(L.l("`{0}' is not a wrapper for `{1}'"));
 else
  return _dataSource.unwrap(iface);
}

相关文章