Search in sources :

Example 1 with Dimensionable

use of net.sourceforge.pmd.lang.java.ast.Dimensionable in project pmd by pmd.

the class VariableNameDeclaration method isArray.

public boolean isArray() {
    ASTVariableDeclaratorId astVariableDeclaratorId = (ASTVariableDeclaratorId) node;
    ASTType typeNode = astVariableDeclaratorId.getTypeNode();
    if (typeNode != null) {
        return ((Dimensionable) typeNode.jjtGetParent()).isArray();
    } else {
        return false;
    }
}
Also used : ASTType(net.sourceforge.pmd.lang.java.ast.ASTType) ASTVariableDeclaratorId(net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId) Dimensionable(net.sourceforge.pmd.lang.java.ast.Dimensionable)

Example 2 with Dimensionable

use of net.sourceforge.pmd.lang.java.ast.Dimensionable in project pmd by pmd.

the class VariableNameDeclaration method getArrayDepth.

public int getArrayDepth() {
    ASTVariableDeclaratorId astVariableDeclaratorId = (ASTVariableDeclaratorId) node;
    ASTType typeNode = astVariableDeclaratorId.getTypeNode();
    if (typeNode != null) {
        return ((Dimensionable) typeNode.jjtGetParent()).getArrayDepth();
    } else {
        return 0;
    }
}
Also used : ASTType(net.sourceforge.pmd.lang.java.ast.ASTType) ASTVariableDeclaratorId(net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId) Dimensionable(net.sourceforge.pmd.lang.java.ast.Dimensionable)

Aggregations

ASTType (net.sourceforge.pmd.lang.java.ast.ASTType)2 ASTVariableDeclaratorId (net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId)2 Dimensionable (net.sourceforge.pmd.lang.java.ast.Dimensionable)2