protected boolean shouldApplyThisRuleTo ( ClassNode classNode ) { // TODO Consider caching applyTo, doNotApplyTo and associated WildcardPatterns boolean shouldApply = true ; String applyTo = getApplyToClassNames ( ) ; String doNotApplyTo = getDoNotApplyToClassNames ( ) ; if ( applyTo != null && applyTo . length ( ) > 0 ) { WildcardPattern pattern = new WildcardPattern ( applyTo , true ) ; shouldApply = pattern . matches ( classNode . getNameWithoutPackage ( ) ) || pattern . matches ( classNode . getName ( ) ) ; } if ( shouldApply && doNotApplyTo != null && doNotApplyTo . length ( ) > 0 ) { WildcardPattern pattern = new WildcardPattern ( doNotApplyTo , true ) ; shouldApply = ! pattern . matches ( classNode . getNameWithoutPackage ( ) ) && ! pattern . matches ( classNode . getName ( ) ) ; } return shouldApply ; }
Return true if this rule should be applied for the specified ClassNode based on the configuration of this rule .