检查对象是否是指定接口的实现。
<p>
不会触发到指定接口的{@link Class}，所以如果ClassLoader中没有指定接口类时，也不会出错。

@param obj
要检查的对象
@param interfaceClazzName
指定的接口名
@return 返回{@code true}，如果对象实现了指定接口；否则返回{@code false}。
760485
public static boolean isInstance(Object obj, String interfaceClazzName) {
		for (Class<?> clazz = obj.getClass(); clazz != null
				&& !clazz.equals(Object.class); clazz = clazz.getSuperclass()) {
			Class<?>[] interfaces = clazz.getInterfaces();
			for (Class<?> itf : interfaces) {
				if (itf.getName().equals(interfaceClazzName)) {
					return true;
				}
			}
		}
		return false;
	}
86856
private static void getAllInterfaces(Class<?> cls, Collection<Class<?>> interfacesFound) {
        while (cls != null) {
            Class<?>[] interfaces = cls.getInterfaces();

            for (int i = 0; i < interfaces.length; i++) {
                interfacesFound.add(interfaces[i]);
                getAllInterfaces(interfaces[i], interfacesFound);
            }

            cls = cls.getSuperclass();
         }
     }
64056
@Override
	public <T> T getInterface(Class<T> clasz) {
		return ((Invocable) scriptEngine).getInterface(clasz);
	}
237782
public JClass []getInterfaces()
  {
    lazyLoad();
    
    JClass []interfaces = new JClass[_interfaces.size()];

    for (int i = 0; i < _interfaces.size(); i++) {
      String name = _interfaces.get(i);
      name = name.replace('/', '.');
      
      interfaces[i] = getClassLoader().forName(name);
    }
    
    return interfaces;
  }
991582
public boolean isSubtypeOf(Class<?> clazz) {
		if (isType(clazz)) {
			return true;
		}
		// TODO interfaces don't inherit from non-interfaces, primitives, arrays, object
		// A final type does not have any subtypes
		JvmType type = findType(clazz);
		if (type == null) {
			return false;
		}
		return isSubtypeOf(type);
	}
1101635
@Override
	public <T> T getInterface(Object thiz, Class<T> clasz) {
		return ((Invocable) scriptEngine).getInterface(thiz, clasz);
	}
57036
public boolean isInstanceOf(Object obj, Class<?> clz) {
        if (obj == null || clz == null) {
            if (log.isLoggable(Level.FINEST)) {
                log.finest("isInstanceOf error: obj=" + obj + " clz=" + clz);
            }
            return false;
        }
        return clz.isInstance(obj);
    }
65536
public Object createObject(String className, Class clazz) throws ClassNotFoundException {
        Object object;
        try {
            object = clazz.newInstance();

        } catch (InstantiationException ie) {
            String info = "Could not create " + description + " object: " + className
                    + ". Could not access object constructor: ";
            info += ie.getMessage();
            throw new ClassNotFoundException(info, ie);

        } catch (IllegalAccessException iae) {
            String info = "Could not create " + description + " object: " + className
                    + ". Could not instantiate object. Does the object classname refer to an abstract class, "
                    + "an interface or the like?: ";
            info += iae.getMessage();
            throw new ClassNotFoundException(info, iae);

        } catch (ClassCastException cce) {
            String info = "Could not create " + description + " object: " + className
                    + ". The specified object classname does not refer to the proper type: ";
            info += cce.getMessage();
            throw new ClassNotFoundException(info, cce);
        }

        return object;
    }
694971
public boolean canPersist(Class<?> cls) {
		Object mapper = OBJECT_MAPPERS.get(cls);
		if (mapper == null) {
			// The only way the mapper wouldn't already be loaded into
			// OBJECT_MAPPERS is if it was compiled separately, but let's handle
			// it anyway
			String beanClassName = cls.getName();
			String mapperClassName = cls.getName() + KriptonBinder.MAPPER_CLASS_SUFFIX;
			try {
				Class<?> mapperClass = (Class<?>) Class.forName(mapperClassName);
				mapper = mapperClass.newInstance();
				// mapper.

				return true;
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
				throw new KriptonRuntimeException(String.format("Class '%s' does not exist. Does '%s' have @BindType annotation?", mapperClassName, beanClassName));
			} catch (InstantiationException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
		}
		return false;

	}
321624
public static String getClassName(Class<?> clazz, boolean isSimple) {
		if (null == clazz) {
			return null;
		}
		return isSimple ? clazz.getSimpleName() : clazz.getName();
	}
434948
public static Boolean isEngineeringObjectClass(Class<?> clazz) {
        for (Field field : clazz.getDeclaredFields()) {
            if (field.isAnnotationPresent(OpenEngSBForeignKey.class)) {
                return true;
            }
        }
        return false;
    }
471316
public static Class<?>[] getAllInterfaces(Class<?> clz) {
    HashSet<Class<?>> set = new HashSet<>();
    getAllInterfaces(clz, set);
    return set.toArray(new Class<?>[set.size()]);
  }
1235872
@SneakyThrows
    public static <T extends Collection> T toCollection(final Object obj, final Class<T> clazz) {
        val results = toCollection(obj);
        if (clazz.isInterface()) {
            throw new IllegalArgumentException("Cannot accept an interface " + clazz.getSimpleName() + " to create a new object instance");
        }
        val col = clazz.getDeclaredConstructor().newInstance();
        col.addAll(results);
        return col;
    }
332664
public static boolean isWeldProxy(Object obj) {
        Class<?> clazz = obj.getClass();
        boolean result = isWeldProxy(clazz);
        return result;
    }
1069919
private boolean methodExists(Class clazz, String name) {
        Method[] methods = clazz.getDeclaredMethods();
        for (int i = 0; i < methods.length; i++) {
            if (methods[i].getName().equals(name)) {
                return true;
            }
        }

        if (clazz.getSuperclass() != null
                && methodExists(clazz.getSuperclass(), name)) {
            return true;
        }

        Class[] interfaces = clazz.getInterfaces();
        for (int i = 0; i < interfaces.length; i++) {
            if (methodExists(interfaces[i], name)) {
                return true;
            }
        }

        return false;
    }
574018
public static <T> Class<T> getClass(final T object) {

    if (object == null) {
      return null;
    }
    @SuppressWarnings("unchecked")
    Class<T> clazz = (Class<T>) object.getClass();
    return clazz;
  }
1026497
public static <T extends Annotation> Set<Method> getAnnotatedPublicMethods(Class<?> clazz, Class<T> annotation) {
		// 已递归到Objebt.class, 停止递归
		if (Object.class.equals(clazz)) {
			return Collections.emptySet();
		}

		List<Class<?>> ifcs = ClassUtils.getAllInterfaces(clazz);
		Set<Method> annotatedMethods = new HashSet<Method>();

		// 遍历当前类的所有公共方法
		Method[] methods = clazz.getMethods();

		for (Method method : methods) {
			// 如果当前方法有标注，或定义了该方法的所有接口有标注
			if (method.getAnnotation(annotation) != null || searchOnInterfaces(method, annotation, ifcs)) {
				annotatedMethods.add(method);
			}
		}

		return annotatedMethods;
	}