Populate model/ hierarchy
[yangtools.git] / model / yang-model-ri / src / main / java / org / opendaylight / yangtools / yang / model / ri / type / AbstractLengthRestrictedType.java
1 /*
2  * Copyright (c) 2015 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.ri.type;
9
10 import java.util.Collection;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
16 import org.opendaylight.yangtools.yang.model.api.type.LengthRestrictedTypeDefinition;
17
18 abstract class AbstractLengthRestrictedType<T extends LengthRestrictedTypeDefinition<T>>
19         extends AbstractRestrictedType<T> implements LengthRestrictedTypeDefinition<T> {
20     private final @Nullable LengthConstraint lengthConstraint;
21
22     AbstractLengthRestrictedType(final T baseType, final QName qname,
23             final Collection<? extends UnknownSchemaNode> unknownSchemaNodes,
24             final @Nullable LengthConstraint lengthConstraint) {
25         super(baseType, qname, unknownSchemaNodes);
26         this.lengthConstraint = lengthConstraint;
27     }
28
29     @Override
30     public final Optional<LengthConstraint> getLengthConstraint() {
31         return Optional.ofNullable(lengthConstraint);
32     }
33 }