Populate model/ hierarchy
[yangtools.git] / model / 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  * @param <N> Native data type
18  */
19 public interface RangeRestrictedTypeDefinition<T extends TypeDefinition<T>, N extends Number & Comparable<N>>
20         extends TypeDefinition<T> {
21     /**
22      * Returns range constraint of this type, if applicable. This is the effective constraint, e.g. it includes any
23      * range constraints implied by base type hierarchy.
24      *
25      * @return range constraint which are specified in the <code>range</code> substatement of the <code>type</code>
26      *         statement.
27      */
28     Optional<RangeConstraint<N>> getRangeConstraint();
29 }