Java Class InstanceOf instanceOf(final Class classVerifiable, final Class classAssignable)

Here you can find the source of instanceOf(final Class classVerifiable, final Class classAssignable)

Description

The instanceof command is used to determine if a Java class is of a given type.

License

Open Source License

Parameter

Parameter Description
classVerifiable the class verifiable
classAssignable the class assignable

Return

true, if instanceof

Declaration

public final static boolean instanceOf(final Class<?> classVerifiable, final Class<?> classAssignable) 

Method Source Code

//package com.java2s;

public class Main {
    /**/* w w w  . j av a 2  s  .  c  o  m*/
     * The instanceof command is used to determine if a Java class is of a
     * given type. The classVerifiable argument specifies an class handle.
     * The classAssignable specifies an interface or class. If the type
     * argument is a class name, instanceof will return true if the
     * classVerifiable is an instance of classAssignable class. If the type
     * argument is an interface, method returns true if the classVerifiable
     * argument implements the interface. Otherwise, returns false.
     *
     * @param classVerifiable the class verifiable
     * @param classAssignable the class assignable
     * @return true, if <classVerifiable> instanceof <classAssignable>
     */
    public final static boolean instanceOf(final Class<?> classVerifiable, final Class<?> classAssignable) {
        return classAssignable.isAssignableFrom(classVerifiable);
    }
}

Related

  1. instanceOf(Class tester, Class instance)
  2. instanceOf(Class beanClass, Object element)
  3. instanceOf(Class objectClass, Class typeClass)
  4. instanceOf(Class parant, Class chield)
  5. instanceOf(Class test, Class clazz)
  6. instanceOf(final Object a, final Class b)
  7. instanceOf(final Object object, final Class... classes)
  8. instanceOf(Object o, Class clazz)
  9. instanceOf(Object o, Class c)