X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcommon%2Futil%2FArguments.java;h=6d8081edb6415a92f3bf898ea14245d74b6f9c9e;hp=902665d1a6fa137d41d7f1bc89cf8116fbb52ee1;hb=81b0b9d6fd26b1567bfc6dd80fa1a90bd30bff0b;hpb=67dd6d9e323157551345f89d3c00c8ebad068a11 diff --git a/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Arguments.java b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Arguments.java index 902665d1a6..6d8081edb6 100644 --- a/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Arguments.java +++ b/opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/sal/common/util/Arguments.java @@ -7,24 +7,26 @@ */ package org.opendaylight.controller.sal.common.util; -public class Arguments { - +@Deprecated(forRemoval = true) +public final class Arguments { private Arguments() { throw new UnsupportedOperationException("Utility class"); } - + /** - * Checks if value is instance of provided class - * - * + * Checks if value is instance of provided class. + * * @param value Value to check * @param type Type to check * @return Reference which was checked + * @deprecated This utility is not used in this project, please brew your own or + * use {@code Preconditions.checkArgument()}. */ - @SuppressWarnings("unchecked") - public static T checkInstanceOf(Object value, Class type) { - if(!type.isInstance(value)) - throw new IllegalArgumentException(); - return (T) value; + @Deprecated(forRemoval = true) + public static T checkInstanceOf(final Object value, final Class type) { + if (!type.isInstance(value)) { + throw new IllegalArgumentException(String.format("Value %s is not of type %s", value, type)); + } + return type.cast(value); } }