container/components/components/src/main/java/org/mobicents/slee/container/component/validator/ClassUtils.java
public static Class checkInterfaces(Class classOrInterfaceWithInterfaces, String interfaceSearched) {
		Class returnValue = null;

		if (classOrInterfaceWithInterfaces.getName().compareTo(interfaceSearched) == 0) {
			return classOrInterfaceWithInterfaces;

		}
		// we do check only on get interfaces
		for (Class iface : classOrInterfaceWithInterfaces.getInterfaces()) {
			if (iface.getName().compareTo(interfaceSearched) == 0) {
				returnValue = iface;

			} else {
				returnValue = checkInterfaces(iface, interfaceSearched);
			}

			if (returnValue != null)
				break;
		}

		if (!classOrInterfaceWithInterfaces.isInterface() && returnValue == null) {
			Class superClass = classOrInterfaceWithInterfaces.getSuperclass();
			if (superClass != null) {
				returnValue = checkInterfaces(superClass, interfaceSearched);
			}
		}

		return returnValue;
	}
public static Class checkInterfaces(Class classOrInterfaceWithInterfaces, String interfaceSearched) {
		Class returnValue = null;

		if (classOrInterfaceWithInterfaces.getName().compareTo(interfaceSearched) == 0) {
			return classOrInterfaceWithInterfaces;

		}
		// we do check only on get interfaces
		for (Class iface : classOrInterfaceWithInterfaces.getInterfaces()) {
			if (iface.getName().compareTo(interfaceSearched) == 0) {
				returnValue = iface;

			} else {
				returnValue = checkInterfaces(iface, interfaceSearched);
			}

			if (returnValue != null)
				break;
		}

		if (!classOrInterfaceWithInterfaces.isInterface() && returnValue == null) {
			Class superClass = classOrInterfaceWithInterfaces.getSuperclass();
			if (superClass != null) {
				returnValue = checkInterfaces(superClass, interfaceSearched);
			}
		}

		return returnValue;
	}
Searches for provided interface in passed Class object - it can be class
or interface. If it finds, it return instance of it.

@param classOrInterfaceWithInterfaces
@param interfaceSearched
@return