public List < ? extends TypeMirror > interfaceGenericTypesFor ( TypeElement element , String interfaceName ) { for ( TypeMirror tm : element . getInterfaces ( ) ) { DeclaredType declaredType = ( DeclaredType ) tm ; Element declaredElement = declaredType . asElement ( ) ; if ( declaredElement instanceof TypeElement ) { TypeElement te = ( TypeElement ) declaredElement ; if ( interfaceName . equals ( te . getQualifiedName ( ) . toString ( ) ) ) { return declaredType . getTypeArguments ( ) ; } } } return Collections . emptyList ( ) ; }
Finds the generic types for the given interface for the given class element .