@Retention(value=RUNTIME) @Target(value={FIELD,TYPE}) public @interface ColumnFamily
Column Family
in HBase table and Column
name will be empty String ""
if there is no annotation Column/ColumnFamily
added to the class/field and the field type is not an entity with getter/setter methods.
public static class Account { @Id private String id; // columnFamily/Column in HBase will be: "id:" private String gui; // columnFamily/Column in HBase will be: "gui:" private Name name; // columnFamily/Column in HBase will be: "name:firstName" and "name:lastName" private String emailAddress; // columnFamily/Column in HBase will be: "emailAddress:" } public static class Name { private String firstName; // columnFamily/Column in HBase will be: "name:firstName" private String lastName; // columnFamily/Column in HBase will be: "name:lastName" }But if the class is annotated by @ColumnFamily, the field name in the class will be mapped to
Column
in HBase table.
@ColumnFamily("columnFamily2B"); public static class Account { @Id private String id; // columnFamily/Column in HBase will be: "columnFamily2B:id" @Column("guid") private String gui; // columnFamily/Column in HBase will be: "columnFamily2B:guid" @ColumnFamily("fullName") private Name name; // columnFamily/Column in HBase will be: "fullName:givenName" and "fullName:lastName" @ColumnFamily("email") private String emailAddress; // columnFamily/Column in HBase will be: "email:emailAddress" } public static class Name { @Column("givenName") private String firstName; private String lastName; }
public abstract String value
Copyright © 2021. All rights reserved.