org.qi4j.api.util

## Class Classes

- java.lang.Object
- - org.qi4j.api.util.Classes

-     public final class Classes
      extends Object

  Useful methods for handling Classes.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Function<Type,Class<?>>` | `RAW_CLASS` Function that extract the raw class of a type.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Specification<ModelDescriptor>` | `assignableTypeSpecification(Class type)`
    `static Iterable<Class<?>>` | `classHierarchy(Class<?> type)`
    `static String` | `denormalizeURIToClass(String uriPart)`
    `static Specification<ModelDescriptor>` | `exactTypeSpecification(Class type)`
    `static <AnnotationType extends Annotation> AnnotationType` | `findAnnotationOfTypeOrAnyOfSuperTypes(Class<?> type, Class<AnnotationType> annotationClass)`
    `static <T> Function<Type,Iterable<T>>` | `forClassHierarchy(Function<Class<?>,Iterable<T>> function)`
    `static <T> Function<Type,Iterable<T>>` | `forTypes(Function<Type,Iterable<T>> function)`
    `static Specification<Class<?>>` | `hasModifier(int classModifier)`
    `static Specification<Object>` | `instanceOf(Class clazz)`
    `static Iterable<? extends Type>` | `interfacesOf(Iterable<? extends Type> types)`
    `static Iterable<Type>` | `interfacesOf(Type type)`
    `static Set<Class<?>>` | `interfacesWithMethods(Set<Class<?>> interfaces)`
    `static Specification<Class<?>>` | `isAssignableFrom(Class clazz)`
    `static Specification<Member>` | `memberNamed(String name)`
    `static Specification<ModelDescriptor>` | `modelTypeSpecification(String className)`
    `static String` | `normalizeClassToURI(String className)`
    `static Type` | `resolveTypeVariable(TypeVariable name, Class declaringClass, Class topClass)` Given a type variable, find what it resolves to given the declaring class where type variable was found and a top class that extends the declaring class.
    `static String` | `simpleGenericNameOf(Type type)`
    `static Function<Type,String>` | `toClassName()`
    `static String` | `toClassName(String uri)` Get class name from a URI
    `static String` | `toString(Iterable<? extends Class> type)`
    `static String` | `toURI(Class clazz)` Get URI for a class.
    `static String` | `toURI(String className)` Get URI for a class name.
    `static Type` | `typeOf(AccessibleObject from)`
    `static Iterable<Type>` | `typesOf(Iterable<Type> types)`
    `static Iterable<Type>` | `typesOf(Type type)`
    `static Type` | `wrapperClass(Type type)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### RAW_CLASS

          public static final Function<Type,Class<?>> RAW_CLASS

      Function that extract the raw class of a type.

  - ### Method Detail

    - #### typeOf

          public static Type typeOf(AccessibleObject from)

    - #### typesOf

          public static Iterable<Type> typesOf(Iterable<Type> types)

    - #### typesOf

          public static Iterable<Type> typesOf(Type type)

    - #### interfacesOf

          public static Iterable<? extends Type> interfacesOf(Iterable<? extends Type> types)

    - #### interfacesOf

          public static Iterable<Type> interfacesOf(Type type)

    - #### classHierarchy

          public static Iterable<Class<?>> classHierarchy(Class<?> type)

    - #### wrapperClass

          public static Type wrapperClass(Type type)

    - #### isAssignableFrom

          public static Specification<Class<?>> isAssignableFrom(Class clazz)

    - #### instanceOf

          public static Specification<Object> instanceOf(Class clazz)

    - #### hasModifier

          public static Specification<Class<?>> hasModifier(int classModifier)

    - #### forClassHierarchy

          public static <T> Function<Type,Iterable<T>> forClassHierarchy(Function<Class<?>,Iterable<T>> function)

    - #### forTypes

          public static <T> Function<Type,Iterable<T>> forTypes(Function<Type,Iterable<T>> function)

    - #### interfacesWithMethods

          public static Set<Class<?>> interfacesWithMethods(Set<Class<?>> interfaces)

    - #### simpleGenericNameOf

          public static String simpleGenericNameOf(Type type)

    - #### findAnnotationOfTypeOrAnyOfSuperTypes

          public static <AnnotationType extends Annotation> AnnotationType findAnnotationOfTypeOrAnyOfSuperTypes(Class<?> type,
                                                                                                 Class<AnnotationType> annotationClass)

    - #### memberNamed

          public static Specification<Member> memberNamed(String name)

    - #### resolveTypeVariable

          public static Type resolveTypeVariable(TypeVariable name,
                                 Class declaringClass,
                                 Class topClass)

      Given a type variable, find what it resolves to given the declaring class where type variable was found and a top class that extends the declaring class.
      Parameters:
        `name` - The TypeVariable name.
        `declaringClass` - The class where the TypeVariable is declared.
        `topClass` - The top class that extends the declaringClass
      Returns:
        The Type instance of the given TypeVariable

    - #### toURI

          public static String toURI(Class clazz)
                              throws NullPointerException

      Get URI for a class.
      Parameters:
        `clazz` - class
      Returns:
        URI
      Throws:
        `NullPointerException` - if clazz is null

    - #### toURI

          public static String toURI(String className)
                              throws NullPointerException

      Get URI for a class name.

      Example:

      Class name com.example.Foo$Bar is converted to URI urn:qi4j:com.example.Foo-Bar

      Parameters:
        `className` - class name
      Returns:
        URI
      Throws:
        `NullPointerException` - if className is null

    - #### toClassName

          public static String toClassName(String uri)
                                    throws NullPointerException

      Get class name from a URI
      Parameters:
        `uri` - URI
      Returns:
        class name
      Throws:
        `NullPointerException` - if uri is null

    - #### normalizeClassToURI

          public static String normalizeClassToURI(String className)

    - #### denormalizeURIToClass

          public static String denormalizeURIToClass(String uriPart)

    - #### modelTypeSpecification

          public static Specification<ModelDescriptor> modelTypeSpecification(String className)

    - #### exactTypeSpecification

          public static Specification<ModelDescriptor> exactTypeSpecification(Class type)

    - #### assignableTypeSpecification

          public static Specification<ModelDescriptor> assignableTypeSpecification(Class type)

    - #### toString

          public static String toString(Iterable<? extends Class> type)

    - #### toClassName

          public static Function<Type,String> toClassName()