Populate data/ hierarchy
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / type / LengthRestrictedTypeDefinition.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 lengths.
15  *
16  * @param <T> Concrete {@link TypeDefinition} subinterface
17  */
18 public interface LengthRestrictedTypeDefinition<T extends TypeDefinition<T>> extends TypeDefinition<T> {
19     /**
20      * Returns length constraint of this type, if applicable. This is the effective constraint, e.g. it includes any
21      * length constraints implied by base type hierarchy.
22      *
23      * @return length constraint which are specified in the <code>length</code> substatement of the <code>type</code>
24      *         statement.
25      */
26     Optional<LengthConstraint> getLengthConstraint();
27 }