@Test public void portMapperTest() { PortMapper portMapper = Mappers.getMapper(PortMapper.class); PortInfoData portInfoData = new PortInfoData(TEST_SWITCH_ID, 1, PortChangeType.UP); Port port = portMapper.map(portInfoData); Assert.assertEquals(PortStatus.UP, port.getStatus()); PortInfoData portInfoDataMapping = portMapper.map(port); Assert.assertEquals(TEST_SWITCH_ID, portInfoDataMapping.getSwitchId()); Assert.assertEquals(1, portInfoDataMapping.getPortNo()); }
@Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData);
PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData); }
PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData);  }
PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData);  @Mapping(source = "state", target = "status") abstract Port map(PortInfoData portInfoData); @Mapping(target = "timestamp", ignore = true) @Mapping(target = "maxCapacity", ignore = true) @Mapping(target = "state", ignore = true) @Mapping(target = "enabled", ignore = true) abstract PortInfoData map(Port port); PortStatus map(PortChangeType portChangeType); @Mapping(source = "switchObj.switchId", target = "switchId") @Mapping(source = "port", target = "portNumber") @Mapping(target = "timestamp", ignore = true) abstract PortPropertiesPayload map(PortProperties portProperties); }
PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData);  @Mapping(source = "state", target = "status") abstract Port map(PortInfoData portInfoData); @Mapping(target = "timestamp", ignore = true) @Mapping(target = "maxCapacity", ignore = true) @Mapping(target = "state", ignore = true) @Mapping(target = "enabled", ignore = true) abstract PortInfoData map(Port port); PortStatus map(PortChangeType portChangeType); @Mapping(source = "switchObj.switchId", target = "switchId") @Mapping(source = "port", target = "portNumber") @Mapping(target = "timestamp", ignore = true) abstract PortPropertiesPayload map(PortProperties portProperties); static final PortMapper INSTANCE; }