2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.parser.builder.api;
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;
15 public interface ConstraintsBuilder extends Builder<ConstraintDefinition> {
18 * Returns module name in which constraint is defined.
22 String getModuleName();
26 * Return line on which constraints were defined.
34 * Returns number of minimum required elements.
36 * This constraint has meaning only if associated node is list or leaf-list.
38 * @return number of minimum required elements.
40 Integer getMinElements();
44 * Sets number of minimum required elements.
46 * This constraint has meaning only if associated node is list or leaf-list.
49 * number of minimum required elements.
51 void setMinElements(Integer minElements);
55 * Returns number of maximum required elements.
57 * This constraint has meaning only if associated node is list or leaf-list.
59 * @return number of maximum required elements.
61 Integer getMaxElements();
65 * Sets number of maximum required elements.
67 * This constraint has meaning only if associated node is list or leaf-list.
70 * number of maximum required elements.
72 void setMaxElements(Integer maxElements);
75 * Returns <code>must</code> definition associated with this builder.
77 * @return <code>must</code> definition associated with this builder.
79 Set<MustDefinition> getMustDefinitions();
82 * Adds must definition to product of this builder.
85 * <code>must</code> definition which should be associated with
88 void addMustDefinition(MustDefinition must);
91 * Returns when condition associated with this constraints.
93 * @return when condition associated with this constraints.
95 String getWhenCondition();
98 * Sets when condition associated with this constraints.
100 * @param whenCondition
103 void addWhenCondition(String whenCondition);
106 * Returns true if associated node is mandatory.
109 * @return true if associated node is mandatory.
111 boolean isMandatory();
114 * Sets mandatory status of parent node
116 * @param mandatory mandatory status
118 void setMandatory(boolean mandatory);
121 * Build constraint definition
123 * @return instance of ConstraintDefinition created from this builder
125 * @deprecated Use {@link #build()} instead
128 ConstraintDefinition toInstance();