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.controller.yang.parser.builder.api;
10 import java.util.ArrayList;
11 import java.util.List;
13 import org.opendaylight.controller.yang.common.QName;
14 import org.opendaylight.controller.yang.model.api.TypeDefinition;
15 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
16 import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
19 * Basic implementation for TypeAwareBuilder builders.
21 public abstract class AbstractTypeAwareBuilder implements TypeAwareBuilder {
22 protected final int line;
23 protected final QName qname;
24 protected Builder parent;
25 protected TypeDefinition<?> type;
26 protected TypeDefinitionBuilder typedef;
27 protected List<UnknownSchemaNode> unknownNodes;
28 protected final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
30 public AbstractTypeAwareBuilder(final int line, final QName qname) {
36 public int getLine() {
41 public Builder getParent() {
46 public void setParent(final Builder parent) {
51 public QName getQName() {
56 public TypeDefinition<?> getType() {
61 public TypeDefinitionBuilder getTypedef() {
66 public void setType(TypeDefinition<?> type) {
72 public void setTypedef(TypeDefinitionBuilder typedef) {
73 this.typedef = typedef;
78 public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
79 return addedUnknownNodes;
83 public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
84 addedUnknownNodes.add(unknownNode);
87 public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
88 this.unknownNodes = unknownNodes;