Java tutorial
//package com.java2s; //License from project: Apache License import android.support.annotation.NonNull; public class Main { public static <T> void assertInstanceOf(@NonNull T object, @NonNull Class<?> clazz, @NonNull String parameterName) throws AssertionError { check(!clazz.isInstance(object), parameterName + " is not instance of " + clazz.getName() + "."); } public static void check(boolean b, @NonNull String message) { if (b) throw new AssertionError(message); } }