BUG-8043: correct LengthConstraint definition
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / type / JavaLengthConstraints.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.util.type;
9
10 import com.google.common.collect.ImmutableRangeSet;
11 import com.google.common.collect.Range;
12 import com.google.common.collect.RangeSet;
13 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
14
15 final class JavaLengthConstraints {
16     private JavaLengthConstraints() {
17         throw new UnsupportedOperationException();
18     }
19
20     private static final RangeSet<Integer> INTEGER_ALLOWED_RANGES =
21             ImmutableRangeSet.of(Range.closed(0, Integer.MAX_VALUE));
22
23     static final LengthConstraint INTEGER_SIZE_CONSTRAINTS = new LengthConstraint() {
24         @Override
25         public String getReference() {
26             return null;
27         }
28
29         @Override
30         public String getErrorMessage() {
31             return null;
32         }
33
34         @Override
35         public String getErrorAppTag() {
36             return null;
37         }
38
39         @Override
40         public String getDescription() {
41             return null;
42         }
43
44         @Override
45         public RangeSet<Integer> getAllowedRanges() {
46             return INTEGER_ALLOWED_RANGES;
47         }
48     };
49 }