BUG-8043: correct RangeConstraint definition
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / type / RangeRestrictedTypeDefinition.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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.model.api.type;
9
10 import java.util.Optional;
11 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
12
13 /**
14  * Interface for {@link TypeDefinition}s which can have their values restricted to a set of allowed values.
15  *
16  * @param <T> Concrete {@link TypeDefinition} subinterface
17  */
18 public interface RangeRestrictedTypeDefinition<T extends TypeDefinition<T>> extends TypeDefinition<T> {
19     /**
20      * Returns range constraint of this type, if applicable. This is the effective constraint, e.g. it includes any
21      * range constraints implied by base type hierarchy.
22      *
23      * @return range constraint which are specified in the <code>range</code> substatement of the <code>type</code>
24      *         statement.
25      */
26     Optional<RangeConstraint<?>> getRangeConstraint();
27 }