本文整理汇总了Java中org.apache.commons.dbutils.handlers.AbstractListHandler类的典型用法代码示例。如果您正苦于以下问题:Java AbstractListHandler类的具体用法?Java AbstractListHandler怎么用?Java AbstractListHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractListHandler类属于org.apache.commons.dbutils.handlers包,在下文中一共展示了AbstractListHandler类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createListResultSetHandler
import org.apache.commons.dbutils.handlers.AbstractListHandler; //导入依赖的package包/类
public static ResultSetHandler<List<ProxyHistory>> createListResultSetHandler() {
return new AbstractListHandler<ProxyHistory>() {
@Override
protected ProxyHistory handleRow(ResultSet rs) throws SQLException {
return ProxyHistory.create(rs, false);
}
};
}
示例2: adapt
import org.apache.commons.dbutils.handlers.AbstractListHandler; //导入依赖的package包/类
protected void adapt(ObjectDef def) {
try {
// initialize
if (!adapted) {
if (isAdaptStruct()) {
ignoreTables = new HashSet<TableDef>(def.tables());
ignoreColumns = new HashSet<ColumnDef>(def.columns());
} else {
ignoreTables = new HashSet<TableDef>(0);
ignoreColumns = new HashSet<ColumnDef>(0);
}
adapted = true;
}
if (isAdaptStruct() && !def.tableNames().isEmpty()) {
String sql = "SELECT TABLE_NAME, COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME IN ('"
+ StringUtils.join(def.tableNames(), "','") + "')";
List<String[]> result = getqRunner().query(sql, new AbstractListHandler<String[]>(){
@Override
public String[] handleRow(ResultSet rs)
throws SQLException {
return new String[]{rs.getString(1), rs.getString(2)};
}
});
for (String[] row : result) {
String tableName = row[0];
String columnName = row[1];
TableDef tableDef = def.tableByName(tableName);
if (tableDef != null) {
ignoreTables.remove(tableDef);
ColumnDef columnDef = tableDef.columnByName(columnName);
if (columnDef != null) {
ignoreColumns.remove(columnDef);
}
}
}
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}