@Override public void mapAtoB(DeviceDO deviceDO, Device device, MappingContext context) { Map<String, String> map = Maps.newHashMap(); if (deviceDO.getDeviceExts() != null) { for (DeviceExtDO deviceExtDO : deviceDO.getDeviceExts()) { map.put(deviceExtDO.getEntityField().getCode(), deviceExtDO.getValue()); } } device.setExtendedAttributes(map); }
@Override public void mapBtoA(Device device, DeviceDO deviceDO, MappingContext context) { deviceDO.setExtAttributes(device.getExtendedAttributes()); }