Search in sources :

Example 1 with FieldDeclaration

use of apex.jorje.semantic.ast.statement.FieldDeclaration in project pmd by pmd.

the class Helper method getFQVariableName.

static String getFQVariableName(final ASTFieldDeclaration variable) {
    FieldDeclaration n = variable.getNode();
    String name = "";
    try {
        java.lang.reflect.Field f = n.getClass().getDeclaredField("name");
        f.setAccessible(true);
        Identifier nameField = (Identifier) f.get(n);
        name = nameField.getValue();
    } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }
    StringBuilder sb = new StringBuilder().append(n.getDefiningType().getApexName()).append(":").append(name);
    return sb.toString();
}
Also used : ASTFieldDeclaration(net.sourceforge.pmd.lang.apex.ast.ASTFieldDeclaration) FieldDeclaration(apex.jorje.semantic.ast.statement.FieldDeclaration) Identifier(apex.jorje.data.Identifier)

Aggregations

Identifier (apex.jorje.data.Identifier)1 FieldDeclaration (apex.jorje.semantic.ast.statement.FieldDeclaration)1 ASTFieldDeclaration (net.sourceforge.pmd.lang.apex.ast.ASTFieldDeclaration)1