public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder( final MapEntryNode mapEntryNode) { return ImmutableMapEntryNodeBuilder.create(mapEntryNode); }
public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> create(final int sizeHint) { return new ImmutableMapEntryNodeBuilder(sizeHint); }
@Override public MapEntryNode build() { super.withNodeIdentifier(constructNodeIdentifier()); return super.build(); }
@Override public MapEntryNode build() { for (final Entry<QName, Object> key : getNodeIdentifier().getKeyValues().entrySet()) { final DataContainerChild<?, ?> childNode = getChild(childrenQNamesToPaths.get(key.getKey())); // We have enough information to fill-in missing leaf nodes, so let's do that if (childNode == null) { LeafNode<Object> leaf = ImmutableNodes.leafNode(key.getKey(), key.getValue()); LOG.debug("Adding leaf {} implied by key {}", leaf, key); withChild(leaf); } else { DataValidationException.checkListKey(getNodeIdentifier(), key.getKey(), key.getValue(), childNode.getValue()); } } return new ImmutableMapEntryNode(getNodeIdentifier(), buildValue(), getAttributes()); }
@Override public DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> withValue( final Collection<DataContainerChild<? extends PathArgument, ?>> withValue) { fillQnames(withValue, childrenQNamesToPaths); return super.withValue(withValue); }
private static void fillQnames(final Iterable<DataContainerChild<? extends PathArgument, ?>> iterable, final Map<QName, PathArgument> out) { for (final DataContainerChild<? extends PathArgument, ?> childId : iterable) { final PathArgument identifier = childId.getIdentifier(); // Augmentation nodes cannot be keys, and do not have to be present in childrenQNamesToPaths map if (isAugment(identifier)) { continue; } out.put(childId.getNodeType(), identifier); } }
@Override public MapEntryNode build() { for (final Entry<QName, Object> key : getNodeIdentifier().getKeyValues().entrySet()) { final DataContainerChild<?, ?> childNode = getChild(childrenQNamesToPaths.get(key.getKey())); // We have enough information to fill-in missing leaf nodes, so let's do that if (childNode == null) { LeafNode<Object> leaf = ImmutableNodes.leafNode(key.getKey(), key.getValue()); LOG.debug("Adding leaf {} implied by key {}", leaf, key); withChild(leaf); } else { DataValidationException.checkListKey(getNodeIdentifier(), key.getKey(), key.getValue(), childNode.getValue()); } } return new ImmutableMapEntryNode(getNodeIdentifier(), buildValue(), getAttributes()); }
protected ImmutableMapEntryNodeBuilder(final ImmutableMapEntryNode node) { super(node); this.childrenQNamesToPaths = new LinkedHashMap<>(); fillQnames(node.getValue(), childrenQNamesToPaths); }
private static void fillQnames(final Iterable<DataContainerChild<? extends PathArgument, ?>> iterable, final Map<QName, PathArgument> out) { for (final DataContainerChild<? extends PathArgument, ?> childId : iterable) { final PathArgument identifier = childId.getIdentifier(); // Augmentation nodes cannot be keys, and do not have to be present in childrenQNamesToPaths map if (isAugment(identifier)) { continue; } out.put(childId.getNodeType(), identifier); } }
public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder() { return ImmutableMapEntryNodeBuilder.create(); }
@Override public MapEntryNode build() { super.withNodeIdentifier(constructNodeIdentifier()); return super.build(); }
public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> create() { return new ImmutableMapEntryNodeBuilder(); }
@Override public DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> withValue( final Collection<DataContainerChild<? extends PathArgument, ?>> withValue) { fillQnames(withValue, childrenQNamesToPaths); return super.withValue(withValue); }
@Override public DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> withChild( final DataContainerChild<?, ?> child) { // Augmentation nodes cannot be keys, and do not have to be present in childrenQNamesToPaths map if (!isAugment(child.getIdentifier())) { childrenQNamesToPaths.put(child.getNodeType(), child.getIdentifier()); } return super.withChild(child); }
public static DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder() { return ImmutableMapEntryNodeBuilder.create(); }
public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> create() { return new ImmutableMapEntryNodeBuilder(); }
protected ImmutableMapEntryNodeBuilder(final ImmutableMapEntryNode node) { super(node); this.childrenQNamesToPaths = new LinkedHashMap<>(); fillQnames(node.getValue(), childrenQNamesToPaths); }
@Override public DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> withChild( final DataContainerChild<?, ?> child) { // Augmentation nodes cannot be keys, and do not have to be present in childrenQNamesToPaths map if (!isAugment(child.getIdentifier())) { childrenQNamesToPaths.put(child.getNodeType(), child.getIdentifier()); } return super.withChild(child); }
public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder( final MapEntryNode mapEntryNode) { return ImmutableMapEntryNodeBuilder.create(mapEntryNode); }
public static DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> create(final int sizeHint) { return new ImmutableMapEntryNodeBuilder(sizeHint); }