private static Class < ? > extractTypeFromClass ( Class < ? > clazz , Class < ? > source , int typeIndex , Map < TypeVariable , Type > typeVariableMap , Map < Integer , Integer > typeIndexesPerLevel , int nestingLevel , int currentLevel ) { if ( clazz . getName ( ) . startsWith ( "java.util." ) ) { return null ; } if ( clazz . getSuperclass ( ) != null && isIntrospectionCandidate ( clazz . getSuperclass ( ) ) ) { try { return extractType ( clazz . getGenericSuperclass ( ) , source , typeIndex , typeVariableMap , typeIndexesPerLevel , nestingLevel , currentLevel ) ; } catch ( MalformedParameterizedTypeException ex ) { // from getGenericSuperclass() - ignore and continue with interface introspection } } Type [ ] ifcs = clazz . getGenericInterfaces ( ) ; if ( ifcs != null ) { for ( Type ifc : ifcs ) { Type rawType = ifc ; if ( ifc instanceof ParameterizedType ) { rawType = ( ( ParameterizedType ) ifc ) . getRawType ( ) ; } if ( rawType instanceof Class && isIntrospectionCandidate ( ( Class ) rawType ) ) { return extractType ( ifc , source , typeIndex , typeVariableMap , typeIndexesPerLevel , nestingLevel , currentLevel ) ; } } } return null ; }
Extract the generic type from the given Class object .