794905dfad7d8183e04e08f45c075434c370e3d6
[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  *
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.Set;
11 import org.opendaylight.yangtools.concepts.Builder;
12 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
13 import org.opendaylight.yangtools.yang.model.api.MustDefinition;
14
15 public interface ConstraintsBuilder extends Builder<ConstraintDefinition> {
16
17     /**
18      * Returns module name in which constraint is defined.
19      *
20      * @return module name
21      */
22     String getModuleName();
23
24     /**
25      *
26      * Return line on which constraints were defined.
27      *
28      * @return line
29      */
30     int getLine();
31
32     /**
33      *
34      * Returns number of minimum required elements.
35      *
36      * This constraint has meaning only if associated node is list or leaf-list.
37      *
38      * @return number of minimum required elements.
39      */
40     Integer getMinElements();
41
42     /**
43      *
44      * Sets number of minimum required elements.
45      *
46      * This constraint has meaning only if associated node is list or leaf-list.
47      *
48      * @param minElements
49      *            number of minimum required elements.
50      */
51     void setMinElements(Integer minElements);
52
53     /**
54      *
55      * Returns number of maximum required elements.
56      *
57      * This constraint has meaning only if associated node is list or leaf-list.
58      *
59      * @return number of maximum required elements.
60      */
61     Integer getMaxElements();
62
63     /**
64      *
65      * Sets number of maximum required elements.
66      *
67      * This constraint has meaning only if associated node is list or leaf-list.
68      *
69      * @param maxElements
70      *            number of maximum required elements.
71      */
72     void setMaxElements(Integer maxElements);
73
74     /**
75      * Returns <code>must</code> definition associated with this builder.
76      *
77      * @return <code>must</code> definition associated with this builder.
78      */
79     Set<MustDefinition> getMustDefinitions();
80
81     /**
82      * Adds must definition to product of this builder.
83      *
84      * @param must
85      *            <code>must</code> definition which should be associated with
86      *            parent node.
87      */
88     void addMustDefinition(MustDefinition must);
89
90     /**
91      * Returns when condition associated with this constraints.
92      *
93      * @return when condition associated with this constraints.
94      */
95     String getWhenCondition();
96
97     /**
98      * Sets when condition associated with this constraints.
99      *
100      * @param whenCondition
101      *            when condition.
102      */
103     void addWhenCondition(String whenCondition);
104
105     /**
106      * Returns true if associated node is mandatory.
107      *
108      *
109      * @return true if associated node is mandatory.
110      */
111     boolean isMandatory();
112
113     /**
114      * Sets mandatory status of parent node
115      *
116      * @param mandatory mandatory status
117      */
118     void setMandatory(boolean mandatory);
119
120     /**
121      * Build constraint definition
122      *
123      * @return instance of ConstraintDefinition created from this builder
124      *
125      * @deprecated Use {@link #build()} instead
126      */
127     @Deprecated
128     ConstraintDefinition toInstance();
129 }