github地址: https://github.com/54uso/hbase-bean
实例
@HRow(defaultFamily = "B", allField = false)
@Data
public class Model {
@HRowkey
private String row;
@HColumn(family = "C", qualifier = "URL")
private String url;
private String test;
}
调用
@Configuration
@SpringBootApplication
public class Application {
public static void main(String[] args) throws HProcessException {
ApplicationContext context = SpringApplication.run(Application.class, args);
HandlerFactory factory = context.getBean(HandlerFactory.class);
Model model = new Model();
model.setRow("row");
model.setUrl("http://www.test.com");
model.setTest("test");
Put put = factory.buildPut(model);
System.out.println(put);
}
@Bean
public HandlerFactory handlerFactory() {
return new DefaultHandlerFactory();
}
}
输出
{“totalColumns”:1,“row”:“row”,“families”:{“C”:[{“qualifier”:“URL”,“vlen”:21,“tag”:[],“timestamp”:9223372036854775807}]},“ts”:9223372036854775807}
说明
@HRow(defaultFamily=“默认Family”, allField=“是否全部字段都转换”)
@HIgnore //当allField为True的时候,标记哪些字段不转换
@HColumn(family="", qualifier="")
@HRowkey 标记为rowkey