mil.dod.th.checkstyle.ext/src/mil/dod/th/ose/checkstyle/ProductTypeAnnotationCheck.java
private void checkForAnnotation(final DetailAST ast, final DetailAST identToken, final String implementationType)
    {
        // get modifiers block from class definition
        final DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS);
        // get annotations block from modifiers block
        DetailAST modifierChild = modifiers.findFirstToken(TokenTypes.ANNOTATION);
        
        while (modifierChild != null)
        {
            // second time through sibling might not be annotation type
            if (modifierChild.getType() == TokenTypes.ANNOTATION
                    && modifierChild.findFirstToken(TokenTypes.IDENT).getText().contains("ProductType"))
            {
                return; // annotation found, no need to continue checking
            }
            modifierChild = modifierChild.getNextSibling();
        }
        log(identToken.getLineNo(), 
                implementationType + " implementation class without @ProductType annotation");
    }
/**
     * Check all modifiers to find out if the correct annotation type is present.
     * @param ast
     *      the class definition
     * @param identToken
     *      the identifier of the implements clause block
     * @param implementationType
     *      the string value of the identToken
     */
Check all modifiers to find out if the correct annotation type is present.
@param ast
the class definition
@param identToken
the identifier of the implements clause block
@param implementationType
the string value of the identToken
Check all modifiers to find out if the correct annotation type is present . @param ast the class definition @param identToken the identifier of the implements clause block @param implementationType the string value of the identToken
private void checkForAnnotation(final DetailAST ast, final DetailAST identToken, final String implementationType)
    {
        final DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS);
        DetailAST modifierChild = modifiers.findFirstToken(TokenTypes.ANNOTATION);
        while (modifierChild != null)
        {
            if (modifierChild.getType() == TokenTypes.ANNOTATION
                    && modifierChild.findFirstToken(TokenTypes.IDENT).getText().contains("ProductType"))
            {
                return; 
            }
            modifierChild = modifierChild.getNextSibling();
        }
        log(identToken.getLineNo(), 
                implementationType + " implementation class without @ProductType annotation");
    }
private void checkForAnnotation ( final DetailAST ast , final DetailAST identToken , final String implementationType ) { final DetailAST modifiers = ast . findFirstToken ( TokenTypes . MODIFIERS ) ; DetailAST modifierChild = modifiers . findFirstToken ( TokenTypes . ANNOTATION ) ; while ( modifierChild != null ) { if ( modifierChild . getType ( ) == TokenTypes . ANNOTATION && modifierChild . findFirstToken ( TokenTypes . IDENT ) . getText ( ) . contains ( "ProductType" ) ) { return ; } modifierChild = modifierChild . getNextSibling ( ) ; } log ( identToken . getLineNo ( ) , implementationType + " implementation class without @ProductType annotation" ) ; }
Check all modifiers to find out if the correct annotation type is present.
Check all modifiers to find out if the correct annotation type is present .
// get modifiers block from class definition // get annotations block from modifiers block // second time through sibling might not be annotation type // annotation found, no need to continue checking