Returns the class hierarchy of the given type, from bottom to top, starting with the given class itself.
Interfaces are not included.

@param clazz the class of interest
@return the class hierarchy of the given class
975656
private static List<Class<?>> getClassHierarchy(Class<?> clazz) {
		List<Class<?>> hierarchy = new ArrayList<Class<?>>( 4 );

		for ( Class<?> current = clazz; current != null; current = current.getSuperclass() ) {
			hierarchy.add( current );
		}

		return hierarchy;
	}
298974
public String getArrayClassName(Class<?> clazz) {

        if (clazz.isArray()) {
            return getArrayClassName(clazz.getComponentType()) + "[]";
        }

        return clazz.getName();
    }
10641
public static Class<?> getSignificantSupperClass(Class<?> classType) {
        Class<?> supperClass = classType;
        while (classType != null) {
            classType = classType.getSuperclass();
            if (Object.class == classType || null == classType) {
                break;
            }
            supperClass = classType;
        }
        return supperClass;
    }
1190773
public static Class<? extends Iced> getImplClass(Class<? extends Schema> clz) {
    Class<? extends Iced> impl_class = ReflectionUtils.findActualClassParameter(clz, 0);
    if (null == impl_class)
      Log.warn("Failed to find an impl class for Schema: " + clz);
    return impl_class;
  }
816102
public ClassDocImpl getClassDoc(ClassSymbol clazz) {
        ClassDocImpl result = classMap.get(clazz);
        if (result != null) return result;
        if (isAnnotationType(clazz)) {
            result = new AnnotationTypeDocImpl(this, clazz);
        } else {
            result = new ClassDocImpl(this, clazz);
        }
        classMap.put(clazz, result);
        return result;
    }
565015
public static Set<Class<? extends Annotation>> getStereotypes(final Class<?> clazz) {
        final Set<Class<? extends Annotation>> ret = new HashSet<>();

        final Set<Annotation> annotations = getAnnotations(clazz.getAnnotations(), Stereotype.class);
        if (annotations.isEmpty()) {
            return ret;
        }

        for (final Annotation annotation : annotations) {
            ret.add(annotation.annotationType());
        }

        return ret;
    }
1318082
public static Type getTypeHierarchy(List<Type> typeHierarchy, Type t, Class<?> stopAtClass) {
		while (!(isClassType(t) && typeToClass(t).equals(stopAtClass))) {
			typeHierarchy.add(t);
			t = typeToClass(t).getGenericSuperclass();

			if (t == null) {
				break;
			}
		}
		return t;
	}
32287
private Class[] getInterfaces(Class clazz) {
        Class superClazz = clazz;
        Class[] interfaces = clazz.getInterfaces();

        // clazz can be an interface itself and when getInterfaces()
        // is called on an interface it returns only the extending
        // interfaces, not the interface itself.
        if (clazz.isInterface()) {
            Class[] tempInterfaces = new Class[interfaces.length + 1];
            tempInterfaces[0] = clazz;

            System.arraycopy(interfaces, 0, tempInterfaces, 1, interfaces.length);
            interfaces = tempInterfaces;
        }

        // add all interfaces implemented by superclasses to the interfaces array
        while ((superClazz = superClazz.getSuperclass()) != null) {
            Class[] superInterfaces = superClazz.getInterfaces();
            Class[] combInterfaces = new Class[interfaces.length + superInterfaces.length];
            System.arraycopy(interfaces, 0, combInterfaces, 0, interfaces.length);
            System.arraycopy(superInterfaces, 0, combInterfaces, interfaces.length, superInterfaces.length);
            interfaces = combInterfaces;
        }

        /**
         * Must remove duplicate interfaces before calling Proxy.getProxyClass().
         * Duplicates can occur if a subclass re-declares that it implements
         * the same interface as one of its ancestor classes.
         **/
        HashMap unique = new HashMap();
        for (int i = 0; i < interfaces.length; i++) {
            unique.put(interfaces[i].getName(), interfaces[i]);
        }
        /* Add the OJBProxy interface as well */
        unique.put(OJBProxy.class.getName(), OJBProxy.class);

        interfaces = (Class[])unique.values().toArray(new Class[unique.size()]);

        return interfaces;
    }
308687
@SuppressWarnings("unchecked")
  protected <T extends Component> T findAncestor(Class<T> clazz) {
    Stack<? extends Component> componentStack = getComponentStack();
    for (int i = componentStack.size() - 2; i >= 0; i--) {
      Component component = componentStack.get(i);
      if (clazz.equals(component.getClass())) return (T) component;
    }
    return null;
  }
105123
public static Class<?> toNonPrimitiveClass(Class<?> clazz) {
        if (clazz.isPrimitive()) {
            Class<?> primitiveClazz = MethodUtils.getPrimitiveWrapper(clazz);
            // the above method returns
            if (primitiveClazz != null) {
                return primitiveClazz;
            } else {
                return clazz;
            }
        } else {
            return clazz;
        }
    }
382213
public static Field getField(final Class<?> clazz, final String fieldName) {
        //Define return type
        //
        Field
            field = null;

        //For each class in the hierarchy starting with the current class, try to find the declared field
        //
        for (Class<?> current = clazz; current != null && field == null; current = current.getSuperclass()) {
            try {
                //Attempt to get the field, if exception is thrown continue to the next class
                //
                field =
                    current
                        .getDeclaredField(
                            fieldName
                        );
            }
            catch (final NoSuchFieldException e) {
                //ignore and continue searching
                //
            }
        }

        //Return the field we found
        //
        return
            field;
    }
1101067
public static Type toType(Class<?> clazz) {
		Type t = SQL_MAP_ABLE_TYPES.get(clazz);
		if (t == null)
			return Type.OTHER;
		else
			return t;
	}
385358
public static boolean isNormalClass(Class<?> clazz) {
		return null != clazz //
				&& false == clazz.isInterface() //
				&& false == isAbstract(clazz) //
				&& false == clazz.isEnum() //
				&& false == clazz.isArray() //
				&& false == clazz.isAnnotation() //
				&& false == clazz.isSynthetic() //
				&& false == clazz.isPrimitive();//
	}
768878
@SuppressWarnings("unchecked")
	 Class<?>[] getAllInterfacesAndClasses ( Class<?>[] classes ) 
    {
        if(0 == classes.length ) 
        {
            return classes;
        }
        else 
        {
            List<Class<?>> extendedClasses = new ArrayList<Class<?>>();
            // all interfaces hierarchy
            for (Class<?> clazz: classes) {
            	if (clazz != null) 
            	{
            		Class<?>[] interfaces = clazz.getInterfaces();
	                if (interfaces != null)
	                {
	                	extendedClasses.addAll(Arrays.asList(interfaces));
	                }
	                Class<?> superclass = clazz.getSuperclass();
	                if (superclass != null && superclass != Object.class)
	                {
	                	extendedClasses.addAll(Arrays.asList(superclass));
	                }
            	}
            }
            
            //Class::getInterfaces() gets only interfaces/classes implemented/extended directly by a given class.
            //We need to walk the whole way up the tree.
            return (Class[]) ArrayUtils.addAll( classes, getAllInterfacesAndClasses( extendedClasses.toArray(new Class[extendedClasses.size()])));
        }
    }
1279731
private static Type getClosestParentType(final Class<?> cls, final Class<?> superClass) {
        // only look at the interfaces if the super class is also an interface
        if (superClass.isInterface()) {
            // get the generic interfaces of the subject class
            final Type[] interfaceTypes = cls.getGenericInterfaces();
            // will hold the best generic interface match found
            Type genericInterface = null;

            // find the interface closest to the super class
            for (final Type midType : interfaceTypes) {
                Class<?> midClass = null;

                if (midType instanceof ParameterizedType) {
                    midClass = getRawType((ParameterizedType) midType);
                } else if (midType instanceof Class<?>) {
                    midClass = (Class<?>) midType;
                } else {
                    throw new IllegalStateException("Unexpected generic"
                            + " interface type found: " + midType);
                }

                // check if this interface is further up the inheritance chain
                // than the previously found match
                if (isAssignable(midClass, superClass)
                        && isAssignable(genericInterface, (Type) midClass)) {
                    genericInterface = midType;
                }
            }

            // found a match?
            if (genericInterface != null) {
                return genericInterface;
            }
        }

        // none of the interfaces were descendants of the target class, so the
        // super class has to be one, instead
        return cls.getGenericSuperclass();
    }
81053
static Class<?>[] getAncestors(Class<?> clazz) {
        Set<Class<?>> classes = new HashSet<Class<?>>();
        while (clazz != null) {
            classes.add(clazz);
            if (clazz.getSuperclass() != null) {
                classes.add(clazz.getSuperclass());
            }
            classes.addAll(Arrays.asList(clazz.getInterfaces()));
            for (Class<?> interfaze : clazz.getInterfaces()) {
                classes.addAll(Arrays.asList(getAncestors(interfaze)));
            }

            clazz = clazz.getSuperclass();
        }

        return classes.toArray(new Class<?>[classes.size()]);
    }
848938
public static Class<?> primitiveEquivalentOf (Class<?> clazz)
    {
        return clazz.isPrimitive() ? clazz : _objectToPrimitiveMap.get(clazz);
    }