All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flipkart.hbaseobjectmapper.RecordsIterator Maven / Gradle / Ivy

Go to download

HBase ORM is a light-weight, thread-safe and performant library that enables: [1] object-oriented access of HBase rows (Data Access Object) with minimal code and good testability [2] reading from and/or writing to HBase tables in Hadoop MapReduce jobs

There is a newer version: 1.19
Show newest version
package com.flipkart.hbaseobjectmapper;

import org.apache.hadoop.hbase.client.Result;

import java.util.Iterator;

/**
 * Iterator implementation, for internal use only
 *
 * @param  Data type of record
 */
@SuppressWarnings("rawtypes")
class RecordsIterator implements Iterator {
    private final HBObjectMapper hbObjectMapper;
    private final Class clazz;
    private final Iterator resultIterator;

    public RecordsIterator(HBObjectMapper hbObjectMapper, Class clazz, Iterator resultIterator) {
        this.hbObjectMapper = hbObjectMapper;
        this.clazz = clazz;
        this.resultIterator = resultIterator;
    }

    @Override
    public boolean hasNext() {
        return resultIterator.hasNext();
    }

    @Override
    @SuppressWarnings("unchecked")
    public T next() {
        Result result = resultIterator.next();
        return (T) hbObjectMapper.readValue(result, clazz);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy