private <V> List<V> trasfer(ResultScanner resultScanner, HbaseMapper<V> mapper) throws Exception { Iterator<Result> it = resultScanner.iterator(); Result temp = null; List<V> result = new ArrayList<V>(); while (it.hasNext()) { temp = it.next(); result.add(mapper.mapApi(temp)); } return result; }
public <V> V getObject(String tableName, V v, HbaseMapper<V> mapper) throws Exception { HTableInterface htable = dataSource.getConnection(tableName); Get get = mapper.mapGet(v); log.info("get is -[" + get + "]"); Result result = htable.get(get); V r = null; if (!result.isEmpty()) { r = mapper.mapApi(result); log.info( "get one objects from " + tableName + ",rowKeyString is-[" + mapper.getRowKeyString(result) + "]"); } htable.close(); return r; }