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