private String getSignature(DetailAST ast) {
String returnType = "";
String name = getName(ast);
String parameters = "";
if (TokenTypes.METHOD_DEF == ast.getType() || TokenTypes.VARIABLE_DEF == ast.getType()) {
DetailAST modifiersAst = ast.findFirstToken(TokenTypes.MODIFIERS);
if (null != modifiersAst) {
if (null != modifiersAst.findFirstToken(TokenTypes.LITERAL_STATIC)) {
returnType += "static ";
}
if (null != modifiersAst.findFirstToken(TokenTypes.FINAL)) {
returnType += "final ";
}
}
returnType += getTypeAsString(ast.findFirstToken(TokenTypes.TYPE)) + " ";
}
if (TokenTypes.METHOD_DEF == ast.getType() || TokenTypes.CTOR_DEF == ast.getType()) {
DetailAST parametersAst = ast.findFirstToken(TokenTypes.PARAMETERS);
if (null != parametersAst) {
DetailAST check = parametersAst.getFirstChild();
while (null != check) {
if (TokenTypes.PARAMETER_DEF == check.getType()) {
parameters += getTypeAsString(check.findFirstToken(TokenTypes.TYPE)) + ", ";
}
check = check.getNextSibling();
}
parameters = "(" + parameters + ")";
}
}
return returnType + name + parameters;