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.ImmutableRangeSet;
11 import com.google.common.collect.Range;
12 import com.google.common.collect.RangeSet;
13 import java.util.Optional;
14 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
16 final class JavaLengthConstraints {
17 private JavaLengthConstraints() {
21 private static final RangeSet<Integer> INTEGER_ALLOWED_RANGES =
22 ImmutableRangeSet.of(Range.closed(0, Integer.MAX_VALUE));
24 static final LengthConstraint INTEGER_SIZE_CONSTRAINTS = new LengthConstraint() {
26 public Optional<String> getReference() {
27 return Optional.empty();
31 public Optional<String> getErrorMessage() {
32 return Optional.empty();
36 public Optional<String> getErrorAppTag() {
37 return Optional.empty();
41 public Optional<String> getDescription() {
42 return Optional.empty();
46 public RangeSet<Integer> getAllowedRanges() {
47 return INTEGER_ALLOWED_RANGES;