2 * Copyright (c) 2013 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.yangtools.yang.parser.builder.api;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
14 import org.opendaylight.yangtools.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
16 import com.google.common.base.Preconditions;
19 * Base helper implementation of Builders for Yang Model elements.
22 public abstract class AbstractBuilder implements Builder {
23 private String moduleName;
24 private final int line;
25 private Builder parentBuilder;
27 protected final List<UnknownSchemaNode> unknownNodes = new ArrayList<>();
28 protected final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
30 protected AbstractBuilder(final String moduleName, final int line) {
31 this.moduleName = Preconditions.checkNotNull(moduleName,"moduleName must not be null");
36 public String getModuleName() {
42 public void setModuleName(final String moduleName) {
43 this.moduleName = moduleName;
47 public int getLine() {
52 public Builder getParent() {
57 public void setParent(final Builder parentBuilder) {
58 this.parentBuilder = parentBuilder;
62 public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
63 return addedUnknownNodes;
67 public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
68 addedUnknownNodes.add(unknownNode);