Check whether an object is an instance of a specified class.

@param obj the object to check
@param classSimpleName the simple name of the specified class.
@return true if the object is an instance of the specified class
503978
public static boolean isInstanceOf(Object obj, String classSimpleName) {
    if (obj == null) {
      return false;
    }
    
    Class<?> currentClass = obj.getClass();
    while (currentClass != Object.class) {
      if (currentClass.getSimpleName().equals(classSimpleName)) {
        return true;
      } else {
        currentClass = currentClass.getSuperclass();
      }
    }
    return false;
  }
297400
Object getInstanceOfClass(Class cls) {
		if (Boolean.class.isAssignableFrom(cls) || Boolean.TYPE.isAssignableFrom(cls)) {
			return Boolean.FALSE;
		} else if (Integer.TYPE.isAssignableFrom(cls) || Short.TYPE.isAssignableFrom(cls) || Integer.class.isAssignableFrom(cls) || Short.class.isAssignableFrom(cls)) {
			return 0;
		} else if (Long.TYPE.isAssignableFrom(cls) || Long.class.isAssignableFrom(cls)) {
			return 0L;
		} else if (Float.TYPE.isAssignableFrom(cls) || Float.class.isAssignableFrom(cls)) {
			return 0.1F;
		} else if (Double.TYPE.isAssignableFrom(cls) || Double.class.isAssignableFrom(cls)) {
			return 0.1D;
		} else if (cls.isArray()) {
			Class<?> comp = cls.getComponentType();
			Object instance = getInstanceOfClass(comp);
			return new Object[]{instance, instance};
		} else {
			try {
				return cls.newInstance();
			} catch (InstantiationException | IllegalAccessException ex) {
				return getObjectFromConstantFields(cls);
			}
		}
	}
1238843
def verify_is_instance(self, obj, cls, msg=""):
        
        try:
            self.assert_is_instance(obj, cls, msg)
        except AssertionError, e:
            if msg:
                m = "%s:\n%s" % (msg, str(e))
            else:
                m = str(e)
            self.verification_erorrs.append(m)
241832
public static boolean isClassPresent(String classname) {
		try {
			Class.forName(classname);
			return true;
		} catch (ClassNotFoundException e) {

		}
		return false;
	}
1243906
public boolean hasClass(String className) {
        final String classAttr = attributes().getIgnoreCase("class");
        final int len = classAttr.length();
        final int wantLen = className.length();

        if (len == 0 || len < wantLen) {
            return false;
        }

        // if both lengths are equal, only need compare the className with the attribute
        if (len == wantLen) {
            return className.equalsIgnoreCase(classAttr);
        }

        // otherwise, scan for whitespace and compare regions (with no string or arraylist allocations)
        boolean inClass = false;
        int start = 0;
        for (int i = 0; i < len; i++) {
            if (Character.isWhitespace(classAttr.charAt(i))) {
                if (inClass) {
                    // white space ends a class name, compare it with the requested one, ignore case
                    if (i - start == wantLen && classAttr.regionMatches(true, start, className, 0, wantLen)) {
                        return true;
                    }
                    inClass = false;
                }
            } else {
                if (!inClass) {
                    // we're in a class name : keep the start of the substring
                    inClass = true;
                    start = i;
                }
            }
        }

        // check the last entry
        if (inClass && len - start == wantLen) {
            return classAttr.regionMatches(true, start, className, 0, wantLen);
        }

        return false;
    }
753371
public static function isClassInstance($object, $class_name)
    {
        if (class_exists($class_name) && is_object($object)) {
            return (bool) ($object instanceof $class_name);
        }
        return false;
    }
228261
function isObject(obj) {
        if (!obj || !obj.constructor || obj.constructor.name !== 'Object')
            return false;
        else return true;
    }
510212
public static boolean isExpectedType(final Class<?> expectedClass, final Object obj) {
        final Class<?> actualClass;
        if (obj == null) {
            actualClass = null;
        } else {
            actualClass = obj.getClass();
        }
        return Objects.equals(expectedClass, actualClass);
    }
45905
public boolean matches(Object obj) {
        if (!(obj instanceof Throwable))
            return false;

        Throwable throwable = (Throwable) obj;

        String foundMessage = throwable.getMessage();

        return expectedMessageMatcher.matches(foundMessage);
    }
1208379
static boolean isClassPresent(String className) {
        try {
            ClassUtils.class.getClassLoader().loadClass(className);
            return true;
        } catch (Throwable e) {
            return false;
        }
    }
150787
public static boolean isObjectType(Class<?> cls) {
        FieldType fieldType = TYPE_MAPPING.get(cls);
        if (fieldType != null) {
            return false;
        }

        return true;
    }
1189903
public boolean isAssignableFrom(JClass cl)
  {
    if (getName().equals(cl.getName()))
      return true;

    JClass []ifc = cl.getInterfaces();

    for (int i = 0; i < ifc.length; i++) {
      if (isAssignableFrom(ifc[i]))
        return true;
    }

    if (cl.getSuperClass() != null)
      return isAssignableFrom(cl.getSuperClass());
    else
      return false;
  }
1374064
public static Class<?> getNamedClass(Object obj) {
		Class<?> cls = getClass(obj);
		while (cls != null && cls.isAnonymousClass()) {
			cls = cls.getEnclosingClass();
		}
		return cls;
	}
671230
public static boolean isInstance(final Object value, final Type type) {
        if (type == null) {
            return false;
        }

        return value == null ? !(type instanceof Class<?>) || !((Class<?>) type).isPrimitive()
                : isAssignable(value.getClass(), type, null);
    }
87123
public static boolean hasMethod(Object obj, String name) {
		if (obj == null)
			throw new NullPointerException("Object cannot be null");
		if (name == null)
			throw new NullPointerException("Method name cannot be null");

		Class<?> objClass = obj.getClass();

		for (Method method : objClass.getMethods()) {
			if (matchMethod(method, name))
				return true;
		}

		return false;
	}
630711
public static boolean objectInstanceOf(Object object, String className) {
        AssertUtils.assertNotNull(object);

        boolean result = false;

        Class clazz = object.getClass();

        if (clazz.getName().equals(className) == true) {
            result = true;
        }

        return result;
    }
68152
function isPlainObject(obj) {
    return (
        typeof obj === 'object' &&
        obj !== null &&
        obj.constructor === Object &&
        Object.prototype.toString.call(obj) === '[object Object]'
    );
}