@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); } }
@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); } }