/** * Creates a new FullIdent starting from the specified node. * @param ast the node to start from * @return a {@code FullIdent} value */ public static FullIdent createFullIdent(DetailAST ast) { final FullIdent ident = new FullIdent(); extractFullIdent(ident, ast); return ident; }
/** * Recursively extract a FullIdent. * * @param full the FullIdent to add to * @param ast the node to recurse from */ private static void extractFullIdent(FullIdent full, DetailAST ast) { if (ast != null) { if (ast.getType() == TokenTypes.DOT) { extractFullIdent(full, ast.getFirstChild()); full.append("."); extractFullIdent( full, ast.getFirstChild().getNextSibling()); } else if (ast.getType() == TokenTypes.ARRAY_DECLARATOR) { extractFullIdent(full, ast.getFirstChild()); full.append("[]"); } else { full.append(ast); } } }
/** * Creates a new FullIdent starting from the specified node. * @param ast the node to start from * @return a {@code FullIdent} value */ public static FullIdent createFullIdent(DetailAST ast) { final FullIdent ident = new FullIdent(); extractFullIdent(ident, ast); return ident; }
/** * Recursively extract a FullIdent. * * @param full the FullIdent to add to * @param ast the node to recurse from */ private static void extractFullIdent(FullIdent full, DetailAST ast) { if (ast != null) { if (ast.getType() == TokenTypes.DOT) { extractFullIdent(full, ast.getFirstChild()); full.append("."); extractFullIdent( full, ast.getFirstChild().getNextSibling()); } else if (ast.getType() == TokenTypes.ARRAY_DECLARATOR) { extractFullIdent(full, ast.getFirstChild()); full.append("[]"); } else { full.append(ast); } } }