public class DecoratedRecordIterator extends Object implements Iterator<GenericRecord>
Sub class can override next() to update the returned record.
For example, in secondary key querying situation, we should look up record
based on the secondary key which contains primary key.
return new DecoratedRecordIterator(skRecordIterator) {
public GenericRecord next() {
GenericRecord skRecord = super.next();
List<Object> primaryKey = new ArrayList<>(tableDef.getPrimaryKeyColumnNum());
for (String pkName : tableDef.getPrimaryKeyColumnNames()) {
primaryKey.add(skRecord.get(pkName));
}
return queryByPrimaryKey(primaryKey);
}
};
| 限定符和类型 | 字段和说明 |
|---|---|
protected Iterator<GenericRecord> |
recordIterator |
| 构造器和说明 |
|---|
DecoratedRecordIterator(Iterator<GenericRecord> recordIterator) |
protected Iterator<GenericRecord> recordIterator
public DecoratedRecordIterator(Iterator<GenericRecord> recordIterator)
public boolean hasNext()
hasNext 在接口中 Iterator<GenericRecord>public GenericRecord next()
next 在接口中 Iterator<GenericRecord>Copyright © 2019–2020 Alibaba Group Holding Limited. All rights reserved.