2 * Copyright (c) 2015 Pantheon Technologies s.r.o. 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.util.type;
10 import com.google.common.collect.ImmutableList;
11 import java.util.List;
12 import java.util.Optional;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
18 import org.opendaylight.yangtools.yang.model.api.type.RangeRestrictedTypeDefinition;
19 import org.opendaylight.yangtools.yang.model.util.BaseConstraints;
21 abstract class AbstractRangeRestrictedBaseType<T extends RangeRestrictedTypeDefinition<T>> extends AbstractBaseType<T>
22 implements RangeRestrictedTypeDefinition<T> {
23 private final List<RangeConstraint> rangeConstraints;
25 AbstractRangeRestrictedBaseType(final QName qname, final Number minValue, final Number maxValue) {
27 this.rangeConstraints = ImmutableList.of(BaseConstraints.newRangeConstraint(
28 minValue, maxValue, Optional.empty(), Optional.empty()));
31 AbstractRangeRestrictedBaseType(final SchemaPath path, final List<UnknownSchemaNode> unknownSchemaNodes,
32 final List<RangeConstraint> rangeConstraints) {
33 super(path, unknownSchemaNodes);
34 this.rangeConstraints = ImmutableList.copyOf(rangeConstraints);
39 public final List<RangeConstraint> getRangeConstraints() {
40 return rangeConstraints;