2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.md.sal.dom.store.impl.tree;
10 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.PathArgument;
11 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeContainerBuilder;
19 @SuppressWarnings("rawtypes")
20 public class StoreNodeCompositeBuilder {
22 private final StoreMetadataNode.Builder metadata;
24 private final NormalizedNodeContainerBuilder data;
27 private StoreNodeCompositeBuilder(final NormalizedNodeContainerBuilder nodeBuilder) {
28 this.metadata = StoreMetadataNode.builder();
29 this.data = nodeBuilder;
32 @SuppressWarnings("unchecked")
33 public StoreNodeCompositeBuilder add(final StoreMetadataNode node) {
35 data.addChild(node.getData());
40 public StoreMetadataNode build() {
41 return metadata.setData(data.build()).build();
45 public static StoreNodeCompositeBuilder from(final NormalizedNodeContainerBuilder nodeBuilder) {
46 return new StoreNodeCompositeBuilder(nodeBuilder);
49 public static StoreNodeCompositeBuilder from(final StoreMetadataNode previous, final NormalizedNodeContainerBuilder nodeBuilder) {
51 return new StoreNodeCompositeBuilder(nodeBuilder);
54 public StoreNodeCompositeBuilder setIdentifier(final PathArgument identifier) {
55 data.withNodeIdentifier(identifier);