public NodeContext build() { return new NodeContextImpl(this); }
public NodeContextBuilder addAugmentation(java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext>> augmentationType, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext> augmentation) { if (augmentation == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentation); return this; }
public NodeContextBuilder(NodeContext base) { if (base.getKey() == null) { this._key = new NodeContextKey( base.getName() ); this._name = base.getName(); } else { this._key = base.getKey(); this._name = _key.getName(); } this._index = base.getIndex(); if (base instanceof NodeContextImpl) { NodeContextImpl impl = (NodeContextImpl) 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.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
@Override public void addNodeName(@Nonnull final String tableName, final int nodeIndex, @Nonnull final String nodeName, @Nonnull final MappingContext ctx) { final KeyedInstanceIdentifier<NodeContext, NodeContextKey> iid = getMappingIid(tableName).child(NodeContext.class, new NodeContextKey(nodeName)); ctx.put(iid, new NodeContextBuilder().setName(nodeName).setIndex(nodeIndex).build()); }
private NodeContextImpl(NodeContextBuilder base) { if (base.getKey() == null) { this._key = new NodeContextKey( base.getName() ); this._name = base.getName(); } else { this._key = base.getKey(); this._name = _key.getName(); } this._index = base.getIndex(); 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.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev160909.vpp.classifier.context.classify.table.context.NodeContext>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
if (!Objects.equals(_index, other.getIndex())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_name, other.getName())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
@Override public Optional<String> getNodeName(final int tableIndex, final int nodeIndex, @Nonnull final MappingContext ctx) { if (!containsName(tableIndex, ctx)) { return Optional.absent(); } final String tableName = getTableName(tableIndex, ctx); final Optional<ClassifyTableContext> tableCtx = ctx.read(getMappingIid(tableName)); final List<NodeContext> nodeContext = tableCtx.get().getNodeContext(); if (nodeContext == null) { return Optional.absent(); } return Optional.fromNullable(nodeContext.stream() .filter(n -> n.getIndex().equals(nodeIndex)) .findFirst() .map(nodes -> nodes.getName()) .orElse(null)); }