@Override public V3Bonding adapt(Bonding from) { V3Bonding to = new V3Bonding(); if (from.isSetOptions()) { to.setOptions(new V3Options()); to.getOptions().getOptions().addAll(adaptOut(from.getOptions().getOptions())); } if (from.isSetSlaves()) { to.setSlaves(new V3Slaves()); to.getSlaves().getSlaves().addAll(adaptOut(from.getSlaves().getHostNics())); } return to; } }
@Mapping(from = HostNic.class, to = Bond.class) public static Bond map(HostNic model, Bond template) { Bond entity = template == null ? new Bond() : template; if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setName(model.getName()); } if (model.isSetBonding()) { entity.setBonded(true); if (model.getBonding().isSetSlaves()) { entity.getSlaves().clear(); for (HostNic slave : model.getBonding().getSlaves().getHostNics()) { if (slave.isSetName()) { entity.getSlaves().add(slave.getName()); } } } if (model.getBonding().isSetOptions()) { entity.setBondOptions(calculateBondingOptionsString(model)); } } if (model.isSetQos()) { entity.setQos((HostNetworkQos) QosMapper.map(model.getQos(), null)); } return entity; }
if (model.getBonding().isSetOptions()) {