Java Class InstanceOf instanceOf(Class clazz, Class superClass)

Here you can find the source of instanceOf(Class clazz, Class superClass)

Description

instance Of

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    
    public static boolean instanceOf(Class clazz, Class superClass) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    @SuppressWarnings("unchecked")
    /**/*from  w w  w.j a v a 2  s .  c  o m*/
     * Check if a class is a subclass of a super class.
     * @param clazz - The class.
     * @param superClass - The super class.
     * @return Whether the class is a subclass of a super class.
     */
    public static boolean instanceOf(Class clazz, Class superClass) {
        return clazz != null && superClass != null && clazz.isAssignableFrom(superClass);
    }
}

Related

  1. instanceOf(Class clazz, Class target)
  2. instanceOf(Class left, Class right)
  3. instanceOf(Class tester, Class instance)
  4. instanceOf(Class beanClass, Object element)