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

com.lordofthejars.nosqlunit.hbase.model.ParsedRowModel Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.lordofthejars.nosqlunit.hbase.model;

import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.hbase.util.Bytes;

public class ParsedRowModel {
    
    private String key;
    private String keyType;
    private List columns = new ArrayList();
    
    public String getKey() {
        return key;
    }
    
    public void setKey(String key) {
        this.key = key;
    }
    
    public byte[] getKeyInBytes() {
        if ("Integer".equals(keyType)) {
            return Bytes.toBytes(Integer.parseInt(key));
        }
        if ("Long".equals(keyType)) {
            return Bytes.toBytes(Long.parseLong(key));
        }
        if ("Double".equals(keyType)) {
            return Bytes.toBytes(Double.parseDouble(key));
        }
        if ("Float".equals(keyType)) {
            return Bytes.toBytes(Float.parseFloat(key));
        }
        if ("Short".equals(keyType)) {
            return Bytes.toBytes(Short.parseShort(key));
        }
        return Bytes.toBytes(key);
    }
    
    public String getKeyType() {
        return keyType;
    }
    
    public void setKeyType(String keyType) {
        this.keyType = keyType;
    }
    
    public List getColumns() {
        return columns;
    }
    
    public void setColumns(List columns) {
        this.columns = columns;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy