@Mapping(from = VmNetworkInterface.class, to = Nic.class) public static Nic map(VmNetworkInterface entity, Nic template) { Nic model = template != null ? template : new Nic(); if (entity.getVmId() != null) { model.setVm(new Vm()); model.getVm().setId(entity.getVmId().toString()); } if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getName() != null) { model.setName(entity.getName()); } if (entity.getMacAddress() != null) { model.setMac(new Mac()); model.getMac().setAddress(entity.getMacAddress()); } model.setLinked(entity.isLinked()); model.setInterface(map(entity.getType())); model.setPlugged(entity.isPlugged()); if (entity.getVnicProfileId() != null) { model.setVnicProfile(new VnicProfile()); model.getVnicProfile().setId(entity.getVnicProfileId().toString()); } return model; }
to.setLinked(from.isLinked());