Merge "Bug 1331 - Generate SPIs and yangs to target/generated-sources/ subfolders"
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / ConstraintsBuilder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
3  * This program and the accompanying materials are made available under the
4  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
5  * and is available at http://www.eclipse.org/legal/epl-v10.html
6  */
7 package org.opendaylight.yangtools.yang.parser.builder.api;
8
9 import java.util.Set;
10 import org.opendaylight.yangtools.concepts.Builder;
11 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
12 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
13
14 public interface ConstraintsBuilder extends Builder<ConstraintDefinition> {
15
16     /**
17      * Returns module name in which constraint is defined.
18      *
19      * @return module name
20      */
21     String getModuleName();
22
23     /**
24      *
25      * Return line on which constraints were defined.
26      *
27      * @return line
28      */
29     int getLine();
30
31     /**
32      *
33      * Returns number of minimum required elements.
34      *
35      * This constraint has meaning only if associated node is list or leaf-list.
36      *
37      * @return number of minimum required elements.
38      */
39     Integer getMinElements();
40
41     /**
42      *
43      * Sets number of minimum required elements.
44      *
45      * This constraint has meaning only if associated node is list or leaf-list.
46      *
47      * @param minElements
48      *            number of minimum required elements.
49      */
50     void setMinElements(Integer minElements);
51
52     /**
53      *
54      * Returns number of maximum required elements.
55      *
56      * This constraint has meaning only if associated node is list or leaf-list.
57      *
58      * @return number of maximum required elements.
59      */
60     Integer getMaxElements();
61
62     /**
63      *
64      * Sets number of maximum required elements.
65      *
66      * This constraint has meaning only if associated node is list or leaf-list.
67      *
68      * @param minElements
69      *            number of maximum required elements.
70      */
71     void setMaxElements(Integer maxElements);
72
73     /**
74      * Returns <code>must</code> definition associated with this builder.
75      *
76      * @return <code>must</code> definition associated with this builder.
77      */
78     Set<MustDefinition> getMustDefinitions();
79
80     /**
81      * Adds must definition to product of this builder.
82      *
83      * @param must
84      *            <code>must</code> definition which should be associated with
85      *            parent node.
86      */
87     void addMustDefinition(MustDefinition must);
88
89     /**
90      * Returns when condition associated with this constraints.
91      *
92      * @return when condition associated with this constraints.
93      */
94     String getWhenCondition();
95
96     /**
97      * Sets when condition associated with this constraints.
98      *
99      * @param whenCondition
100      *            when condition.
101      */
102     void addWhenCondition(String whenCondition);
103
104     /**
105      * Returns true if associated node is mandatory.
106      *
107      *
108      * @return true if associated node is mandatory.
109      */
110     boolean isMandatory();
111
112     /**
113      * Sets mandatory status of parent node
114      *
115      * @param mandatory
116      */
117     void setMandatory(boolean mandatory);
118
119     /**
120      * Build constraint definition
121      *
122      * @return
123      */
124     ConstraintDefinition toInstance();
125
126 }