Class Generics


  • public final class Generics
    extends Object
    Generics utility.
    • Method Detail

      • getGenericClassType

        public static Type getGenericClassType​(Object instance,
                                               Class<?> clazz,
                                               int position)
        Returns the generic type at the given position for the given class.
        Parameters:
        instance - the implementing instance
        clazz - the generic class
        position - the generic position
        Returns:
        the generic type at the given position
      • getGenericInterfaceType

        public static Type getGenericInterfaceType​(Object instance,
                                                   Class<?> iface,
                                                   int position)
        Returns the generic type at the given position for the given interface.
        Parameters:
        instance - the implementing instance
        iface - the generic interface
        position - the generic position
        Returns:
        the generic type at the given position