Class Generics

    • Method Detail

      • getTypeParameter

        public static Class<?> getTypeParameter​(Class<?> klass)
        Finds the type parameter for the given class.
        Parameters:
        klass - a parameterized class
        Returns:
        the class's type parameter
      • getTypeParameter

        public static <T> Class<T> getTypeParameter​(Class<?> klass,
                                                    Class<? super T> bound)
        Finds the type parameter for the given class which is assignable to the bound class.
        Type Parameters:
        T - the type bound
        Parameters:
        klass - a parameterized class
        bound - the type bound
        Returns:
        the class's type parameter