@Test public void simple() { DataModelDescriptor descriptor = FieldPropertyDescriptor.extract(MockSimple.class); MockSimple obj = (MockSimple) descriptor.createDataModelObject(); obj.number.modify(12345); obj.string.modify("Hello, world!"); DataModelInspector inspector = new DataModelInspector(descriptor); assertThat(inspector.getTypeName(), is(MockSimple.class.getName())); assertThat(inspector.getAllStructFieldRefs(), hasSize(2)); assertThat(inspector.getStructFieldsDataAsList(obj), is(Arrays.asList(new Object[] { obj.number, obj.string, }))); assertThat(getJavaField(inspector, obj, "number"), equalTo((Object) 12345)); assertThat(getJavaField(inspector, obj, "string"), equalTo((Object) "Hello, world!")); DataModelDriver driver = new DataModelDriver(descriptor, inspector); MockSimple copy = new MockSimple(); driver.set(copy, obj); assertThat(copy.number, equalTo(obj.number)); assertThat(copy.string, equalTo(obj.string)); }
public void set(Object dataModel, Object source) { StructObjectInspector inspector = this.sourceInspector; StructField[] sources = this.sourceFields; PropertyDescriptor[] targets = this.targetProperties; ValueDriver[] drivers = propertyDrivers; for (int i = 0; i < sources.length; i++) { Object value = inspector.getStructFieldData(source, sources[i]); ValueOption<?> option = targets[i].extract(dataModel); drivers[i].set(option, value); } }
DataModelDriver { public void set(Object dataModel, Object source) { StructObjectInspector inspector = this.sourceInspector; StructField[] sources = this.sourceFields; PropertyDescriptor[] targets = this.targetProperties; ValueDriver[] drivers = propertyDrivers; for (int i = 0; i < sources.length; i++) { Object value = inspector.getStructFieldData(source, sources[i]); ValueOption<?> option = targets[i].extract(dataModel); drivers[i].set(option, value); } } }
DataModelDriver { public void set(Object dataModel, Object source) { StructObjectInspector inspector = this.sourceInspector; StructField[] sources = this.sourceFields; PropertyDescriptor[] targets = this.targetProperties; ValueDriver[] drivers = propertyDrivers; for (int i = 0; i < sources.length; i++) { Object value = inspector.getStructFieldData(source, sources[i]); ValueOption<?> option = targets[i].extract(dataModel); drivers[i].set(option, value); } } DataModelDriver(DataModelDescriptor descriptor, StructObjectInspector sourceInspector);  DataModelDriver(
            DataModelDescriptor descriptor, StructObjectInspector sourceInspector, DataModelMapping configuration); }
DataModelDriver { public void set(Object dataModel, Object source) { StructObjectInspector inspector = this.sourceInspector; StructField[] sources = this.sourceFields; PropertyDescriptor[] targets = this.targetProperties; ValueDriver[] drivers = propertyDrivers; for (int i = 0; i < sources.length; i++) { Object value = inspector.getStructFieldData(source, sources[i]); ValueOption<?> option = targets[i].extract(dataModel); drivers[i].set(option, value); } } DataModelDriver(DataModelDescriptor descriptor, StructObjectInspector sourceInspector);  DataModelDriver(
            DataModelDescriptor descriptor, StructObjectInspector sourceInspector, DataModelMapping configuration); StructObjectInspector getSourceInspector(); List<StructField> getSourceFields(); void set(Object dataModel, Object source); }
DataModelDriver { public void set(Object dataModel, Object source) { StructObjectInspector inspector = this.sourceInspector; StructField[] sources = this.sourceFields; PropertyDescriptor[] targets = this.targetProperties; ValueDriver[] drivers = propertyDrivers; for (int i = 0; i < sources.length; i++) { Object value = inspector.getStructFieldData(source, sources[i]); ValueOption<?> option = targets[i].extract(dataModel); drivers[i].set(option, value); } } DataModelDriver(DataModelDescriptor descriptor, StructObjectInspector sourceInspector);  DataModelDriver(
            DataModelDescriptor descriptor, StructObjectInspector sourceInspector, DataModelMapping configuration); StructObjectInspector getSourceInspector(); List<StructField> getSourceFields(); void set(Object dataModel, Object source);  }