X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcommon%2Futil%2FArguments.java;h=d09024aea0ccf73a50006c9c28bdca4e3b7a9aa1;hb=8da08c9f008d371c491cf6b35494ca36c2ebdcb9;hp=2d10fba8a5fd77c18b872991669d576f9aae7a7e;hpb=4f5a4b3e71e81c6149a1ca78ca418866e152c45b;p=controller.git 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 2d10fba8a5..d09024aea0 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 @@ -1,23 +1,30 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.common.util; -public class Arguments { +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 */ @SuppressWarnings("unchecked") public static T checkInstanceOf(Object value, Class type) { - if(!type.isInstance(value)) - throw new IllegalArgumentException(); + if (!type.isInstance(value)) { + throw new IllegalArgumentException(String.format("Value %s is not of type %s", value, type)); + } return (T) value; } }