static ExecutableType getExecutableElementAsMemberOf ( Types types , ExecutableElement executableElement , TypeElement subTypeElement ) { checkNotNull ( types ) ; checkNotNull ( executableElement ) ; checkNotNull ( subTypeElement ) ; TypeMirror subTypeMirror = subTypeElement . asType ( ) ; if ( ! subTypeMirror . getKind ( ) . equals ( TypeKind . DECLARED ) ) { throw new IllegalStateException ( "Expected subTypeElement.asType() to return a class/interface type." ) ; } TypeMirror subExecutableTypeMirror = types . asMemberOf ( ( DeclaredType ) subTypeMirror , executableElement ) ; if ( ! subExecutableTypeMirror . getKind ( ) . equals ( TypeKind . EXECUTABLE ) ) { throw new IllegalStateException ( "Expected subExecutableTypeMirror to be an executable type." ) ; } return ( ExecutableType ) subExecutableTypeMirror ; }
Given an executable element in a supertype returns its ExecutableType when it is viewed as a member of a subtype .