/** * Return a MD-SAL inter-switch link ID in the given instance identifier. * * @param path An {@link InstanceIdentifier} instance. * @return A MD-SAL inter-switch link ID if found. * {@code null} if not found. */ public static LinkId getLinkId(InstanceIdentifier<?> path) { LinkKey key = path.firstKeyOf(Link.class); return (key == null) ? null : key.getLinkId(); }
private LinkImpl(LinkBuilder base) { if (base.getKey() == null) { this._key = new LinkKey( base.getLinkId() ); this._linkId = base.getLinkId(); } else { this._key = base.getKey(); this._linkId = _key.getLinkId(); } this._destination = base.getDestination(); this._source = base.getSource(); this._supportingLink = base.getSupportingLink(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>>, Augmentation<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public LinkBuilder(Link base) { if (base.getKey() == null) { this._key = new LinkKey( base.getLinkId() ); this._linkId = base.getLinkId(); } else { this._key = base.getKey(); this._linkId = _key.getLinkId(); } this._destination = base.getDestination(); this._source = base.getSource(); this._supportingLink = base.getSupportingLink(); if (base instanceof LinkImpl) { LinkImpl impl = (LinkImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
LinkImpl(LinkBuilder base) { if (base.key() != null) { this.key = base.key(); } else { this.key = new LinkKey(base.getLinkId()); } this._linkId = key.getLinkId(); this._destination = base.getDestination(); this._source = base.getSource(); this._supportingLink = base.getSupportingLink(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }