public static boolean classNodeImplementsType ( ClassNode node , Class target ) { ClassNode targetNode = ClassHelper . make ( target ) ; if ( node . implementsInterface ( targetNode ) ) { return true ; } if ( node . isDerivedFrom ( targetNode ) ) { return true ; } if ( node . getName ( ) . equals ( target . getName ( ) ) ) { return true ; } if ( node . getName ( ) . equals ( target . getSimpleName ( ) ) ) { return true ; } if ( node . getSuperClass ( ) != null && node . getSuperClass ( ) . getName ( ) . equals ( target . getName ( ) ) ) { return true ; } if ( node . getSuperClass ( ) != null && node . getSuperClass ( ) . getName ( ) . equals ( target . getSimpleName ( ) ) ) { return true ; } if ( node . getInterfaces ( ) != null ) { for ( ClassNode declaredInterface : node . getInterfaces ( ) ) { if ( classNodeImplementsType ( declaredInterface , target ) ) { return true ; } } } return false ; }
This method tells you if a ClassNode implements or extends a certain class .