Class Generics

java.lang.Object
io.dropwizard.util.Generics

public class Generics extends Object
Helper methods for class type parameters.
See Also:
  • Method Details

    • 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