Class GenericsUtil


  • public class GenericsUtil
    extends Object
    Author:
    Nathan Sweet
    • Constructor Detail

      • GenericsUtil

        public GenericsUtil()
    • Method Detail

      • resolveType

        public static Type resolveType​(Class fromClass,
                                       Class toClass,
                                       Type type)
        Returns the class for the specified type after replacing any type variables using the class hierarchy between the specified classes.
        Parameters:
        toClass - Must be a sub class of fromClass.
      • resolveTypeParameters

        public static Type[] resolveTypeParameters​(Class fromClass,
                                                   Class toClass,
                                                   Type type)
        Resolves type variables for the type parameters of the specified type by using the class hierarchy between the specified classes.
        Parameters:
        toClass - Must be a sub class of fromClass.
        Returns:
        Null if the type has no type parameters, else contains Class entries for type parameters that were resolved and TypeVariable entries for type parameters that couldn't be resolved.