Merge "Added more Rpc markers to yang-binding."
[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.yang.model.api.YangNode;
13 import org.opendaylight.yangtools.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
14
15 /**
16  * Parent interface for all builder interfaces.
17  */
18 public interface Builder {
19
20     /**
21      * Get name of module in which this node is 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      */
32     void setModuleName(String moduleName);
33
34     /**
35      * Get current line in yang file.
36      *
37      * @return current line in yang file
38      */
39     int getLine();
40
41     /**
42      * Get parent node of this node.
43      *
44      * @return parent node builder or null if this is top level node
45      */
46     Builder getParent();
47
48     /**
49      * Set parent of this node.
50      *
51      * @param parent
52      *            parent node builder
53      */
54     void setParent(Builder parent);
55
56     /**
57      * Add unknown node to this builder.
58      *
59      * @param unknownNode
60      */
61     void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode);
62
63     /**
64      * Get builders of unknown nodes defined in this node.
65      *
66      * @return collection of UnknownSchemaNodeBuilder objects
67      */
68     List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders();
69
70     /**
71      * Build YANG data model node.
72      *
73      * This method should create an instance of YANG data model node. After
74      * creating an instance, this instance should be returned for each call
75      * without repeating build process.
76      *
77      * @return YANG data model node
78      */
79     Object build(YangNode parent);
80
81     interface Rebuildable<T extends Builder> {
82         T toBuilder();
83     }
84 }