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); }
public NodeContextBuilder addAugmentation(Class<? extends Augmentation<NodeContext>> augmentationType, Augmentation<NodeContext> augmentationValue) { if (augmentationValue == null) { return removeAugmentation(augmentationType); } if (!(this.augmentation instanceof HashMap)) { this.augmentation = new HashMap<>(); } this.augmentation.put(augmentationType, augmentationValue); return this; }
@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()); }