Deprecate common.util.Arguments for removal
[controller.git] / opendaylight / md-sal / sal-common-util / src / main / java / org / opendaylight / controller / sal / common / util / Arguments.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. 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.controller.sal.common.util;
9
10 @Deprecated(forRemoval = true)
11 public final class Arguments {
12     private Arguments() {
13         throw new UnsupportedOperationException("Utility class");
14     }
15
16     /**
17      * Checks if value is instance of provided class.
18      *
19      * @param value Value to check
20      * @param type Type to check
21      * @return Reference which was checked
22      * @deprecated This utility is not used in this project, please brew your own or
23      *             use {@code Preconditions.checkArgument()}.
24      */
25     @Deprecated(forRemoval = true)
26     public static <T> T checkInstanceOf(final Object value, final Class<T> type) {
27         if (!type.isInstance(value)) {
28             throw new IllegalArgumentException(String.format("Value %s is not of type %s", value, type));
29         }
30         return type.cast(value);
31     }
32 }