Class ReflectionUtils


  • public class ReflectionUtils
    extends java.lang.Object
    Just slightly adapted from http://www.artima.com/weblogs/viewpost.jsp?thread=208860
    Author:
    Ian Robertson, Fabrizio Giudici
    • Constructor Summary

      Constructors 
      Constructor Description
      ReflectionUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Class<?> getClass​(java.lang.reflect.Type type)  
      static <T> java.util.List<java.lang.Class<?>> getTypeArguments​(java.lang.Class<T> baseClass, java.lang.Class<? extends T> childClass)
      Get the actual type arguments a subclass has used to extend a generic base class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReflectionUtils

        public ReflectionUtils()
    • Method Detail

      • getTypeArguments

        @Nonnull
        public static <T> java.util.List<java.lang.Class<?>> getTypeArguments​(@Nonnull
                                                                              java.lang.Class<T> baseClass,
                                                                              @Nonnull
                                                                              java.lang.Class<? extends T> childClass)
        Get the actual type arguments a subclass has used to extend a generic base class.
        Type Parameters:
        T - the static type of the base class
        Parameters:
        baseClass - the base class
        childClass - the subclass
        Returns:
        a list of the raw classes for the actual type arguments.
      • getClass

        @Nonnull
        public static java.lang.Class<?> getClass​(@Nonnull
                                                  java.lang.reflect.Type type)