Merge "Introduce Identifiables"
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / Builder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.builder.api;
9
10 import java.util.List;
11
12 import org.opendaylight.yangtools.concepts.Mutable;
13 import org.opendaylight.yangtools.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
14
15 /**
16  * Parent interface for all builder interfaces.
17  */
18 public interface Builder extends Mutable {
19
20     /**
21      * Returns name of module in which node created by this builder
22      * was declared.
23      *
24      * @return module name
25      */
26     String getModuleName();
27
28     /**
29      * Set name of module in which this node is declared.
30      *
31      * @param moduleName
32      * @deprecated Module name should be set during creation of builder.
33      */
34     @Deprecated
35     void setModuleName(String moduleName);
36
37     /**
38      * Get current line in yang file, on which statement
39      * associated with this builder was declared.
40      *
41      * @return current line in yang file
42      */
43     int getLine();
44
45     /**
46      * Returns parent node builder of this node.
47      *
48      * @return parent node builder or null if this is top level node
49      */
50     Builder getParent();
51
52     /**
53      * Set parent of this node.
54      *
55      * @param parent
56      *            parent node builder
57      */
58     void setParent(Builder parent);
59
60     /**
61      * Adds an unknown node builder to this builder.
62      *
63      * When product (child) is builded by the {@link #build()}
64      * method, this builder is also built and unknown node is added
65      * as child to the product of this builder.
66      *
67      * @param unknownNode
68      */
69     void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode);
70
71     /**
72      * Get builders of unknown nodes defined in this node.
73      *
74      * @return collection of UnknownSchemaNodeBuilder objects
75      */
76     List<UnknownSchemaNodeBuilder> getUnknownNodes();
77
78     /**
79      * Build YANG data model node.
80      *
81      * This method should create an instance of YANG data model node. After
82      * creating an instance, this instance should be returned for each call
83      * without repeating build process.
84      *
85      * @return YANG data model node
86      */
87     Object build();
88
89 }