return ast.getParent().getType() == TokenTypes.OBJBLOCK;
}
+ /**
+ * Returns the name the method (and the enclosing class) at a given point specified by the
+ * passed-in abstract syntax tree (AST).
+ *
+ * @param ast an abstract syntax tree (AST) pointing to method call
+ * @return the name of the method being called
+ */
public static String getMethodName(final DetailAST ast) {
if (ast.getFirstChild().getLastChild() != null) {
return ast.getFirstChild().getFirstChild().getText() + "." + ast.getFirstChild().getLastChild().getText();
return LOG_METHODS.contains(methodName);
}
+ /**
+ * Returns the name of the closest enclosing class of the point by the passed-in abstract syntax
+ * tree (AST).
+ *
+ * @param ast an abstract syntax tree (AST)
+ * @return the name of the closest enclosign class
+ */
public static String getClassName(final DetailAST ast) {
DetailAST parent = ast.getParent();
while (parent.getType() != TokenTypes.CLASS_DEF && parent.getType() != TokenTypes.ENUM_DEF) {