← back to dordor12__hbase-orm

Function bodies 231 total

All specs Real LLM only Function bodies
getTableName method · java · L299-L301 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    public String getTableName() {
        return mapper.getTableName();
    }
getColumnFamiliesAndVersions method · java · L303-L305 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    public Map<String, Integer> getColumnFamiliesAndVersions() {
        return mapper.getColumnFamiliesAndVersions();
    }
getMapper method · java · L307-L309 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    public HBaseMapper<R, T> getMapper() {
        return mapper;
    }
resultToEntity method · java · L313-L318 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private T resultToEntity(Result result) {
        if (result == null || result.isEmpty()) {
            return null;
        }
        return mapper.readFromResult(result);
    }
resultsToEntities method · java · L320-L328 (9 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private List<T> resultsToEntities(List<Result> results) {
        List<T> entities = new ArrayList<>(results.size());
        for (Result r : results) {
            if (r != null && !r.isEmpty()) {
                entities.add(mapper.readFromResult(r));
            }
        }
        return entities;
    }
getBatch method · java · L330-L351 (22 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private List<CompletableFuture<T>> getBatch(List<R> rowKeys, int numVersionsToFetch,
                                                Executor exec) throws IOException {
        AsyncTable<AdvancedScanResultConsumer> table = getAsyncTable();
        List<Get> gets = new ArrayList<>(rowKeys.size());
        for (R rk : rowKeys) {
            Get g = createGet(rk);
            if (numVersionsToFetch > 1) {
                g.readVersions(numVersionsToFetch);
            }
            gets.add(g);
        }
        List<CompletableFuture<Result>> rawFutures = table.get(gets);
        List<CompletableFuture<T>> result = new ArrayList<>(rawFutures.size());
        for (CompletableFuture<Result> rf : rawFutures) {
            if (exec != null) {
                result.add(applyMapping(rf, this::resultToEntity, exec));
            } else {
                result.add(applyMapping(rf, this::resultToEntity));
            }
        }
        return result;
    }
collectNonNull method · java · L353-L365 (13 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private <V> CompletableFuture<List<V>> collectNonNull(List<CompletableFuture<V>> futures) {
        return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]))
                .thenApply(v -> {
                    List<V> entities = new ArrayList<>(futures.size());
                    for (CompletableFuture<V> f : futures) {
                        V entity = f.join();
                        if (entity != null) {
                            entities.add(entity);
                        }
                    }
                    return entities;
                });
    }
Powered by Repobility — scan your code at https://repobility.com
applyMapping method · java · L367-L372 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private <I, O> CompletableFuture<O> applyMapping(CompletableFuture<I> future, Function<I, O> fn) {
        if (executor != null) {
            return future.thenApplyAsync(fn, executor);
        }
        return future.thenApply(fn);
    }
applyMapping method · java · L374-L379 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private <I, O> CompletableFuture<O> applyMapping(CompletableFuture<I> future, Function<I, O> fn, Executor exec) {
        if (exec != null) {
            return future.thenApplyAsync(fn, exec);
        }
        return future.thenApply(fn);
    }
rowKeyToBytes method · java · L381-L390 (10 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/AsyncHBaseDAO.java
    private byte[] rowKeyToBytes(R rowKey) {
        if (rowKey instanceof String s) return Bytes.toBytes(s);
        if (rowKey instanceof Long l) return Bytes.toBytes(l);
        if (rowKey instanceof Integer i) return Bytes.toBytes(i);
        if (rowKey instanceof Short s) return Bytes.toBytes(s);
        if (rowKey instanceof Float f) return Bytes.toBytes(f);
        if (rowKey instanceof Double d) return Bytes.toBytes(d);
        if (rowKey instanceof byte[] b) return b;
        throw new IllegalArgumentException("Unsupported row key type: " + rowKey.getClass().getName());
    }
HBaseDAO class · java · L25-L290 (266 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
public class HBaseDAO<R, T> {

    private final Connection connection;
    private final HBaseMapper<R, T> mapper;
    private final TableName tableName;

    public HBaseDAO(Connection connection, HBaseMapper<R, T> mapper) {
        this.connection = connection;
        this.mapper = mapper;
        this.tableName = TableName.valueOf(mapper.getTableName());
    }

    // ─── Read Operations ─────────────────────────────────────────────

    public T get(R rowKey) throws IOException {
        return get(rowKey, 1);
    }

    public T get(R rowKey, int numVersionsToFetch) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Get get = createGet(rowKey);
            if (numVersionsToFetch > 1) {
                get.readVersions(numVersionsToFetch);
            }
            Result result = table.get(get);
            if (result == null || result.isEmpty()) {
                return null;
            }
            return mapper.readFromResult(resul
HBaseDAO method · java · L31-L35 (5 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public HBaseDAO(Connection connection, HBaseMapper<R, T> mapper) {
        this.connection = connection;
        this.mapper = mapper;
        this.tableName = TableName.valueOf(mapper.getTableName());
    }
get method · java · L39-L41 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public T get(R rowKey) throws IOException {
        return get(rowKey, 1);
    }
get method · java · L43-L55 (13 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public T get(R rowKey, int numVersionsToFetch) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Get get = createGet(rowKey);
            if (numVersionsToFetch > 1) {
                get.readVersions(numVersionsToFetch);
            }
            Result result = table.get(get);
            if (result == null || result.isEmpty()) {
                return null;
            }
            return mapper.readFromResult(result);
        }
    }
get method · java · L57-L59 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> get(List<R> rowKeys) throws IOException {
        return get(rowKeys, 1);
    }
Repobility analyzer · published findings · https://repobility.com
get method · java · L61-L80 (20 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> get(List<R> rowKeys, int numVersionsToFetch) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            List<Get> gets = new ArrayList<>(rowKeys.size());
            for (R rk : rowKeys) {
                Get g = createGet(rk);
                if (numVersionsToFetch > 1) {
                    g.readVersions(numVersionsToFetch);
                }
                gets.add(g);
            }
            Result[] results = table.get(gets);
            List<T> entities = new ArrayList<>(results.length);
            for (Result r : results) {
                if (r != null && !r.isEmpty()) {
                    entities.add(mapper.readFromResult(r));
                }
            }
            return entities;
        }
    }
get method · java · L82-L84 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> get(R startRowKey, R endRowKey) throws IOException {
        return get(startRowKey, true, endRowKey, false, 1);
    }
get method · java · L86-L96 (11 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> get(R startRowKey, boolean startInclusive,
                       R endRowKey, boolean endInclusive,
                       int numVersionsToFetch) throws IOException {
        Scan scan = new Scan();
        scan.withStartRow(rowKeyToBytes(startRowKey), startInclusive);
        scan.withStopRow(rowKeyToBytes(endRowKey), endInclusive);
        if (numVersionsToFetch > 1) {
            scan.readVersions(numVersionsToFetch);
        }
        return get(scan);
    }
get method · java · L98-L109 (12 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> get(Scan scan) throws IOException {
        List<T> entities = new ArrayList<>();
        try (Table table = connection.getTable(tableName);
             ResultScanner scanner = table.getScanner(scan)) {
            for (Result result : scanner) {
                if (result != null && !result.isEmpty()) {
                    entities.add(mapper.readFromResult(result));
                }
            }
        }
        return entities;
    }
getByPrefix method · java · L111-L113 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> getByPrefix(byte[] rowPrefix) throws IOException {
        return getByPrefix(rowPrefix, 1);
    }
getByPrefix method · java · L115-L122 (8 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> getByPrefix(byte[] rowPrefix, int numVersionsToFetch) throws IOException {
        Scan scan = new Scan();
        scan.setRowPrefixFilter(rowPrefix);
        if (numVersionsToFetch > 1) {
            scan.readVersions(numVersionsToFetch);
        }
        return get(scan);
    }
getOnGet method · java · L124-L132 (9 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public T getOnGet(Get get) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Result result = table.get(get);
            if (result == null || result.isEmpty()) {
                return null;
            }
            return mapper.readFromResult(result);
        }
    }
getOnGets method · java · L134-L145 (12 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<T> getOnGets(List<Get> gets) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Result[] results = table.get(gets);
            List<T> entities = new ArrayList<>(results.length);
            for (Result r : results) {
                if (r != null && !r.isEmpty()) {
                    entities.add(mapper.readFromResult(r));
                }
            }
            return entities;
        }
    }
Same scanner, your repo: https://repobility.com — Repobility
persist method · java · L149-L155 (7 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public R persist(T entity) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Put put = mapper.writeAsPut(entity);
            table.put(put);
            return mapper.getRowKey(entity);
        }
    }
persist method · java · L157-L168 (12 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public List<R> persist(List<T> entities) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            List<Put> puts = new ArrayList<>(entities.size());
            List<R> rowKeys = new ArrayList<>(entities.size());
            for (T entity : entities) {
                puts.add(mapper.writeAsPut(entity));
                rowKeys.add(mapper.getRowKey(entity));
            }
            table.put(puts);
            return rowKeys;
        }
    }
delete method · java · L172-L177 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public void delete(R rowKey) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Delete delete = new Delete(rowKeyToBytes(rowKey));
            table.delete(delete);
        }
    }
deleteEntity method · java · L179-L181 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public void deleteEntity(T entity) throws IOException {
        delete(mapper.getRowKey(entity));
    }
deleteByKeys method · java · L184-L192 (9 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public void deleteByKeys(R... rowKeys) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            List<Delete> deletes = new ArrayList<>(rowKeys.length);
            for (R rk : rowKeys) {
                deletes.add(new Delete(rowKeyToBytes(rk)));
            }
            table.delete(deletes);
        }
    }
deleteEntities method · java · L194-L202 (9 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public void deleteEntities(List<T> entities) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            List<Delete> deletes = new ArrayList<>(entities.size());
            for (T entity : entities) {
                deletes.add(new Delete(mapper.composeRowKey(entity)));
            }
            table.delete(deletes);
        }
    }
increment method · java · L206-L211 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public long increment(R rowKey, String fieldName, long amount) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            byte[][] col = mapper.getColumn(fieldName);
            return table.incrementColumnValue(rowKeyToBytes(rowKey), col[0], col[1], amount);
        }
    }
increment method · java · L213-L218 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public T increment(Increment increment) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Result result = table.increment(increment);
            return mapper.readFromResult(result);
        }
    }
Hi, dataset curator — please cite Repobility (https://repobility.com) when reusing this data.
append method · java · L220-L225 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public T append(Append append) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Result result = table.append(append);
            return mapper.readFromResult(result);
        }
    }
exists method · java · L229-L234 (6 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public boolean exists(R rowKey) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            Get get = createGet(rowKey);
            return table.exists(get);
        }
    }
exists method · java · L237-L245 (9 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public boolean[] exists(R... rowKeys) throws IOException {
        try (Table table = connection.getTable(tableName)) {
            List<Get> gets = new ArrayList<>(rowKeys.length);
            for (R rk : rowKeys) {
                gets.add(createGet(rk));
            }
            return table.exists(gets);
        }
    }
getHBaseTable method · java · L249-L251 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public Table getHBaseTable() throws IOException {
        return connection.getTable(tableName);
    }
createGet method · java · L253-L255 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public Get createGet(R rowKey) {
        return new Get(rowKeyToBytes(rowKey));
    }
createIncrement method · java · L257-L259 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public Increment createIncrement(R rowKey) {
        return new Increment(rowKeyToBytes(rowKey));
    }
createAppend method · java · L261-L263 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public Append createAppend(R rowKey) {
        return new Append(rowKeyToBytes(rowKey));
    }
getTableName method · java · L265-L267 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public String getTableName() {
        return mapper.getTableName();
    }
Powered by Repobility — scan your code at https://repobility.com
getColumnFamiliesAndVersions method · java · L269-L271 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public Map<String, Integer> getColumnFamiliesAndVersions() {
        return mapper.getColumnFamiliesAndVersions();
    }
getMapper method · java · L273-L275 (3 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    public HBaseMapper<R, T> getMapper() {
        return mapper;
    }
rowKeyToBytes method · java · L279-L288 (10 LOC)
hbase-orm-api/src/main/java/io/github/dordor12/hbase/orm/dao/HBaseDAO.java
    private byte[] rowKeyToBytes(R rowKey) {
        if (rowKey instanceof String s) return Bytes.toBytes(s);
        if (rowKey instanceof Long l) return Bytes.toBytes(l);
        if (rowKey instanceof Integer i) return Bytes.toBytes(i);
        if (rowKey instanceof Short s) return Bytes.toBytes(s);
        if (rowKey instanceof Float f) return Bytes.toBytes(f);
        if (rowKey instanceof Double d) return Bytes.toBytes(d);
        if (rowKey instanceof byte[] b) return b;
        throw new IllegalArgumentException("Unsupported row key type: " + rowKey.getClass().getName());
    }
EntityModel class · java · L10-L32 (23 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/EntityModel.java
public record EntityModel(
        String packageName,
        String className,
        String qualifiedName,
        String tableName,
        String tableNamespace,
        Map<String, Integer> familiesAndVersions,
        Map<String, String> rowKeyCodecFlags,
        RowKeyModel rowKeyModel,
        List<FieldModel> fields
) {

    public String mapperClassName() {
        return className + "HBMapper";
    }

    public String fullTableName() {
        if ("default".equals(tableNamespace)) {
            return tableName;
        }
        return tableNamespace + ":" + tableName;
    }
}
EntityModel function · java · L10-L32 (23 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/EntityModel.java
public record EntityModel(
        String packageName,
        String className,
        String qualifiedName,
        String tableName,
        String tableNamespace,
        Map<String, Integer> familiesAndVersions,
        Map<String, String> rowKeyCodecFlags,
        RowKeyModel rowKeyModel,
        List<FieldModel> fields
) {

    public String mapperClassName() {
        return className + "HBMapper";
    }

    public String fullTableName() {
        if ("default".equals(tableNamespace)) {
            return tableName;
        }
        return tableNamespace + ":" + tableName;
    }
}
mapperClassName method · java · L22-L24 (3 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/EntityModel.java
    public String mapperClassName() {
        return className + "HBMapper";
    }
fullTableName method · java · L26-L31 (6 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/EntityModel.java
    public String fullTableName() {
        if ("default".equals(tableNamespace)) {
            return tableName;
        }
        return tableNamespace + ":" + tableName;
    }
FieldModel class · java · L9-L21 (13 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/FieldModel.java
public record FieldModel(
        String fieldName,
        String family,
        String qualifier,
        TypeMirror fieldType,
        TypeMirror valueType,
        boolean multiVersioned,
        Map<String, String> codecFlags,
        String getterName,
        String setterName,
        boolean needsAccessor
) {
}
Repobility analyzer · published findings · https://repobility.com
FieldModel function · java · L9-L21 (13 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/FieldModel.java
public record FieldModel(
        String fieldName,
        String family,
        String qualifier,
        TypeMirror fieldType,
        TypeMirror valueType,
        boolean multiVersioned,
        Map<String, String> codecFlags,
        String getterName,
        String setterName,
        boolean needsAccessor
) {
}
HBaseOrmProcessor class · java · L22-L243 (222 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/HBaseOrmProcessor.java
public class HBaseOrmProcessor extends AbstractProcessor {

    private Messager messager;
    private Elements elements;
    private Types types;
    private Filer filer;

    @Override
    public synchronized void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
        this.messager = processingEnv.getMessager();
        this.elements = processingEnv.getElementUtils();
        this.types = processingEnv.getTypeUtils();
        this.filer = processingEnv.getFiler();
    }

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        for (Element element : roundEnv.getElementsAnnotatedWith(Table.class)) {
            if (element.getKind() != ElementKind.CLASS) {
                messager.printMessage(Diagnostic.Kind.ERROR,
                        "@Table can only be applied to classes", element);
                continue;
            }

            TypeElement typeElement = (TypeElement) element;

  
init method · java · L30-L36 (7 LOC)
hbase-orm-processor/src/main/java/io/github/dordor12/hbase/orm/processor/HBaseOrmProcessor.java
    public synchronized void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
        this.messager = processingEnv.getMessager();
        this.elements = processingEnv.getElementUtils();
        this.types = processingEnv.getTypeUtils();
        this.filer = processingEnv.getFiler();
    }
‹ prevpage 2 / 5next ›