Populate data/ hierarchy
[yangtools.git] / yang / yang-model-ri / src / main / java / org / opendaylight / yangtools / yang / model / ri / type / InvalidRangeConstraintException.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 com.google.common.annotations.Beta;
11 import com.google.common.collect.ImmutableRangeSet;
12 import com.google.common.collect.RangeSet;
13
14 @Beta
15 public class InvalidRangeConstraintException extends IllegalArgumentException {
16     private static final long serialVersionUID = 1L;
17
18     private final ImmutableRangeSet<?> offendingRangeConstraint;
19
20     protected InvalidRangeConstraintException(final RangeSet<?> offendingConstraint, final String message) {
21         super(message);
22         this.offendingRangeConstraint = ImmutableRangeSet.copyOf(offendingConstraint);
23     }
24
25     public InvalidRangeConstraintException(final RangeSet<?> offendingConstraint, final String format,
26             final Object... args) {
27         this(offendingConstraint, String.format(format, args));
28     }
29
30     public final RangeSet<?> getOffendingRanges() {
31         return offendingRangeConstraint;
32     }
33 }