BUG-4268: clarify length constraint API contract
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / type / InvalidBitDefinitionException.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.annotations.Beta;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit;
13
14 @Beta
15 public class InvalidBitDefinitionException extends IllegalArgumentException {
16     private static final long serialVersionUID = 1L;
17     private final Bit offendingBit;
18
19     protected InvalidBitDefinitionException(final Bit offendingBit, final String message) {
20         super(message);
21         this.offendingBit = Preconditions.checkNotNull(offendingBit);
22     }
23
24     public InvalidBitDefinitionException(final Bit offendingBit, final String format,
25             final Object... args) {
26         this(offendingBit, String.format(format, args));
27     }
28
29     public Bit getOffendingBit() {
30         return offendingBit;
31     }
32 }