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.model.api;
11 import javax.annotation.Nullable;
14 * Contains method which returns various data constraints for some YANG element
15 * (e.g. min or max number of elements). Not all constraints are allowed for all
16 * YANG element therefore if the constraint doesn't have sense for some element
17 * then the method returns <code>null</code> value.
19 public interface ConstraintDefinition extends WhenConditionAware {
21 * Specifies the rules which the node which contains <code>must</code> YANG
22 * substatement has to match.
24 * @return set of <code>MustDefinition</code> (XPath) instances which
25 * represents the concrete data constraints
27 Set<MustDefinition> getMustConstraints();
30 * Expreses if the presence of the data element for which this constraint is
31 * specified is|isn't required.
34 * Contains the value of the <b>mandatory</b> YANG substatement.
35 * It is used with YANG statements leaf, choice, anyxml, deviate.
37 * @return boolean value:
39 * <li>true - if <code>mandatory</code> YANG keyword argument =
41 * <li>false - if <code>mandatory</code> YANG keyword argument =
45 boolean isMandatory();
48 * Returns the minimum required number of data elements for node where this
49 * constraint is specified.
52 * The returning value equals to value of the argument of the
53 * <b>min-elements</b> YANG substatement.
54 * It is used with YANG statements leaf-list, list, deviate.
56 * @return integer with minimal number of elements, or null if no minimum is defined
58 @Nullable Integer getMinElements();
61 * Returns the maximum admissible number of data elements for node where
62 * this constraint is specified.
65 * The returning value equals to value of the argument of the
66 * <b>max-elements</b> YANG substatement.
67 * It is used with YANG statements leaf-list, list, deviate.
69 * @return integer with maximum number of elements, or null if no maximum is defined
71 @Nullable Integer getMaxElements();