This is an expensive method, never use it when live (used best at startup).

@param clazz A class implementing {@code Renderable}.
@return Returns a set of widgets that match the given type in this widget chain.
970061
public synchronized <T extends Renderable> Set<T> collect(Class<T> clazz) {
        Set<T> matches = new HashSet<T>();
        for (Renderable widget : widgets) {

            //add any matching classes to the set
            if (clazz.isInstance(widget))
                //noinspection unchecked
                matches.add((T) widget);

            //traverse down widget chains
            if (widget instanceof WidgetChain)
                matches.addAll(widget.collect(clazz));
        }

        return matches;
    }
895706
public static Field[] getFields (Class<?> clazz)
    {
        ArrayList<Field> list = new ArrayList<Field>();
        getFields(clazz, list);
        return list.toArray(new Field[list.size()]);
    }
392850
public static <T> T getBean(Class<T> clazz) throws ReflectionException {
      return parameterizeObject(Reflect.onClass(clazz).create().<T>get());
   }
857860
public static Annotation[] jlClassGetAnnotations(Class<?> clazz) {
		if (TypeRegistry.nothingReloaded) {
			return clazz.getAnnotations();
		}
		ReloadableType rtype = getRType(clazz);
		//Note: even if class has not been reloaded, it's superclass may have been and this may affect
		//  the inherited annotations, so we must *not* use 'getReloadableTypeIfHasBeenReloaded' above!
		if (rtype == null) {
			return clazz.getAnnotations();
		}

		Class<?> superClass = clazz.getSuperclass();
		if (superClass == null) {
			return jlClassGetDeclaredAnnotations(clazz); //Nothing to inherit so it's ok to call this
		}
		Map<Class<? extends Annotation>, Annotation> combinedAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();

		Annotation[] annotationsToAdd = jlClassGetAnnotations(superClass);
		for (Annotation annotation : annotationsToAdd) {
			if (isInheritable(annotation)) {
				combinedAnnotations.put(annotation.annotationType(), annotation);
			}
		}

		annotationsToAdd = jlClassGetDeclaredAnnotations(clazz);
		for (Annotation annotation : annotationsToAdd) {
			combinedAnnotations.put(annotation.annotationType(), annotation);
		}

		return combinedAnnotations.values().toArray(new Annotation[combinedAnnotations.size()]);
	}
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;
    }
1185501
public static <T> T getBean(Class<T> clazz) {
        ApplicationContext appContext = getAppContext();
        
        try {
            return appContext == null ? null : appContext.getBean(clazz);
        } catch (Exception e) {
            return null;
        }
    }
512331
private <T> T get(Class<T> clazz) {
    try {
      return clazz.cast(get());
    } catch (ClassCastException e) {
      return null;
    }
  }
983698
public static Class<?> getRawClass(final Type clazz) {
    if (clazz instanceof Class) {
      return (Class<?>) clazz;
    } else if (clazz instanceof ParameterizedType) {
      return (Class<?>) ((ParameterizedType) clazz).getRawType();
    } else if (clazz instanceof WildcardType) {
      return Object.class; // XXX not really correct, but close enough?
    } else if (clazz instanceof TypeVariable) {
      return Object.class; // XXX not really correct, but close enough?
    } else {
      System.err.println("Can't getRawClass for " + clazz + " of unknown type " + clazz.getClass());
      throw new IllegalArgumentException("Can't getRawClass for " + clazz + " of unknown type " + clazz.getClass());
    }
  }
268828
public <T> Clazz<T> FindClazz( Class<T> clazz )
	{
		if( clazzz == null )
			return null;

		for( Clazz<?> c : clazzz.values() )
			if( c.getReflectedClass() == clazz )
			{
				@SuppressWarnings( "unchecked" )
				Clazz<T> result = (Clazz<T>) c;
				return result;
			}

		return null;
	}
840502
@SuppressWarnings("unchecked")
    public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) {
        return (List<T>) foundAnnotations.get(clazz);
    }
1068488
@SuppressWarnings("rawtypes")
	public JsonWriterI getWriterByInterface(Class<?> clazz) {
		for (WriterByInterface w : writerInterfaces) {
			if (w._interface.isAssignableFrom(clazz))
				return w._writer;
		}
		return null;
	}
334676
@SuppressWarnings("unchecked")
    public <C extends Client> Optional<C> findClient(final Class<C> clazz) {
        CommonHelper.assertNotNull("clazz", clazz);
        init();
        if (clazz != null) {
            for (final Client client : getClients()) {
                if (clazz.isAssignableFrom(client.getClass())) {
                    return Optional.of((C) client);
                }
            }
        }
        LOGGER.debug("No client found for class: {}", clazz);
        return Optional.empty();
    }
802863
public static Class<?> getCollectionClass (Class<?> clazz)
    {
        if (Streamable.class.isAssignableFrom(clazz)) {
            // the class is natively streamable, let's ignore it
            return null;
        }
        for (Class<?> collClass : BasicStreamers.CollectionStreamer.SPECIFICITY_ORDER) {
            if (collClass.isAssignableFrom(clazz)) {
                return collClass;
            }
        }
        return null;
    }
1060777
@SuppressWarnings("unchecked")
    public <P> P createBean(final Class<P> clazz) {
        return (P) beanFactory.create(clazz);
    }
93699
public static Class elementType(Class clazz) {
        checkArrayType(clazz);

        while (clazz.isArray()) {
            clazz = clazz.getComponentType();
        }

        return clazz;
    }
1270739
public static File getClassJar(Class clazz) {
		File file = null;

		try {
			file = new File(clazz.getProtectionDomain().getCodeSource().getLocation().toURI());
		} catch (URISyntaxException e) {}

		return file;
	}
1017896
public static <T> Clazz<T> Clazz( Class<T> clazz )
	{
		return impl.Clazz( clazz );
	}