コード例 #1
0
 @Override
 public void setup(OperatorContext context) {
   try {
     store.connect();
     pojoType = Class.forName(pojoTypeName);
     pojoType.newInstance(); // try create new instance to verify the class.
     rowSetter = PojoUtils.createSetter(pojoType, tableInfo.getRowOrIdExpression(), String.class);
     fieldValueGenerator =
         FieldValueGenerator.getFieldValueGenerator(pojoType, tableInfo.getFieldsInfo());
     valueConverter = new BytesValueConverter();
   } catch (Exception ex) {
     throw new RuntimeException(ex);
   }
 }
コード例 #2
0
  @SuppressWarnings("unchecked")
  protected HBaseFieldValueGenerator(final Class<?> clazz, List<HBaseFieldInfo> fieldInfos) {
    for (HBaseFieldInfo fieldInfo : fieldInfos) {
      fieldInfoMap.put(fieldInfo.getFamilyName() + COLON + fieldInfo.getColumnName(), fieldInfo);

      PojoUtils.Getter<Object, Object> getter =
          PojoUtils.createGetter(
              clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType());
      fieldGetterMap.put(fieldInfo, getter);
    }

    for (HBaseFieldInfo fieldInfo : fieldInfos) {
      PojoUtils.Setter<Object, Object> setter =
          PojoUtils.createSetter(
              clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType());
      fieldSetterMap.put(fieldInfo, setter);
    }
  }