question: @ SuppressWarnings ( "unchecked" ) public static Class < ? extends Enum < ? > > findEnumType ( Enum < ? > en ) { Class < ? > ec = en . getClass ( ) ; if ( ec . getSuperclass ( ) != Enum . class ) { ec = ec . getSuperclass ( ) ; } return ( Class < ? extends Enum < ? > > ) ec ; }
target:  Helper method that can be used to dynamically figure out formal enumeration type (class) for given enumeration. This is either class of enum instance (for "simple" enumerations), or its superclass (for enums with instance fields or methods)