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