@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()); }
public NodeContextBuilder(NodeContext base) { if (base.key() == null) { this.key = new NodeContextKey( base.getName() ); this._name = base.getName(); } else { this.key = base.key(); 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<NodeContext> casted =(AugmentationHolder<NodeContext>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private NodeContextImpl(NodeContextBuilder base) { if (base.key() == null) { this.key = new NodeContextKey( base.getName() ); this._name = base.getName(); } else { this.key = base.key(); this._name = key.getName(); } this._index = base.getIndex(); this.augmentation = ImmutableMap.copyOf(base.augmentation); }