All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.p3c.pmd.lang.java.util.VariableUtils Maven / Gradle / Ivy

package com.alibaba.p3c.pmd.lang.java.util;

import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
import net.sourceforge.pmd.lang.java.ast.AbstractJavaAccessNode;

/**
 * @author caikang
 * @date 2019/04/22
 */
public class VariableUtils {
    public static String getVariableName(AbstractJavaAccessNode typeNode) {
        ASTVariableDeclaratorId decl = typeNode.getFirstDescendantOfType(ASTVariableDeclaratorId.class);
        if (decl != null) {
            return decl.getImage();
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy