Updated Flow Capable Models & AD SAL Compatibility mapping
[controller.git] / opendaylight / md-sal / sal-common-util / src / main / java / org / opendaylight / controller / sal / common / util / Arguments.java
1 package org.opendaylight.controller.sal.common.util;
2
3 public class Arguments {
4
5     private Arguments() {
6         throw new UnsupportedOperationException("Utility class");
7     }
8     
9     /**
10      * Checks if value is instance of provided class
11      * 
12      * 
13      * @param value Value to check
14      * @param type Type to check
15      * @return Reference which was checked
16      */
17     @SuppressWarnings("unchecked")
18     public static <T> T checkInstanceOf(Object value, Class<T> type) {
19         if(!type.isInstance(value))
20             throw new IllegalArgumentException();
21         return (T) value;
22     }
23 }