public final class JavadocUtil extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JavadocUtil.JavadocTagType
The type of Javadoc tag we want returned.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.util.regex.Pattern |
NEWLINE
Newline pattern.
|
private static java.util.regex.Pattern |
RETURN
Return pattern.
|
private static java.util.regex.Pattern |
TAB
Tab pattern.
|
private static java.util.Map<java.lang.String,java.lang.Integer> |
TOKEN_NAME_TO_VALUE
Maps from a token name to value.
|
private static java.util.Map<java.lang.Integer,java.lang.String> |
TOKEN_VALUE_TO_NAME
Maps from a token value to name.
|
private static java.lang.String |
UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE
Exception message for unknown JavaDoc token id.
|
| Modifier | Constructor and Description |
|---|---|
private |
JavadocUtil()
Prevent instantiation.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsInBranch(DetailNode node,
int type)
Checks whether node contains any node of specified type among children on any deep level.
|
static java.lang.String |
escapeAllControlChars(java.lang.String text)
Replace all control chars with escaped symbols.
|
static DetailNode |
findFirstToken(DetailNode detailNode,
int type)
Returns the first child token that has a specified type.
|
static java.lang.String |
getBlockCommentContent(DetailAST blockCommentBegin)
Gets content of block comment.
|
static DetailNode |
getFirstChild(DetailNode node)
Gets first child node of specified node.
|
static java.lang.String |
getJavadocCommentContent(DetailAST javadocCommentBegin)
Get content of Javadoc comment.
|
static JavadocTags |
getJavadocTags(TextBlock textBlock,
JavadocUtil.JavadocTagType tagType)
Gets validTags from a given piece of Javadoc.
|
static DetailNode |
getNextSibling(DetailNode node)
Gets next sibling of specified node.
|
static DetailNode |
getNextSibling(DetailNode node,
int tokenType)
Gets next sibling of specified node with the specified type.
|
static DetailNode |
getPreviousSibling(DetailNode node)
Gets previous sibling of specified node.
|
static java.lang.String |
getTagName(DetailNode javadocTagSection)
Gets tag name from javadocTagSection.
|
static int |
getTokenId(java.lang.String name)
Returns the ID of a token for a given name.
|
static java.lang.String |
getTokenName(int id)
Returns the name of a token for a given ID.
|
static boolean |
isCorrectJavadocPosition(DetailAST blockComment)
Checks Javadoc comment it's in right place.
|
static boolean |
isJavadocComment(DetailAST blockCommentBegin)
Checks block comment content starts with '*' javadoc comment identifier.
|
static boolean |
isJavadocComment(java.lang.String commentContent)
Checks that commentContent starts with '*' javadoc comment identifier.
|
private static final java.util.Map<java.lang.String,java.lang.Integer> TOKEN_NAME_TO_VALUE
private static final java.util.Map<java.lang.Integer,java.lang.String> TOKEN_VALUE_TO_NAME
private static final java.lang.String UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE
private static final java.util.regex.Pattern NEWLINE
private static final java.util.regex.Pattern RETURN
private static final java.util.regex.Pattern TAB
private JavadocUtil()
public static JavadocTags getJavadocTags(TextBlock textBlock, JavadocUtil.JavadocTagType tagType)
textBlock - the Javadoc comment to process.tagType - the type of validTags we're interested inpublic static boolean isJavadocComment(java.lang.String commentContent)
commentContent - content of block commentpublic static boolean isJavadocComment(DetailAST blockCommentBegin)
blockCommentBegin - block comment ASTpublic static java.lang.String getBlockCommentContent(DetailAST blockCommentBegin)
blockCommentBegin - block comment AST.public static java.lang.String getJavadocCommentContent(DetailAST javadocCommentBegin)
javadocCommentBegin - Javadoc comment ASTpublic static DetailNode findFirstToken(DetailNode detailNode, int type)
detailNode - Javadoc AST nodetype - the token type to matchpublic static DetailNode getFirstChild(DetailNode node)
node - DetailNodepublic static boolean containsInBranch(DetailNode node, int type)
node - DetailNodetype - token typepublic static DetailNode getNextSibling(DetailNode node)
node - DetailNodepublic static DetailNode getNextSibling(DetailNode node, int tokenType)
node - DetailNodetokenType - javadoc token typepublic static DetailNode getPreviousSibling(DetailNode node)
node - DetailNodepublic static java.lang.String getTokenName(int id)
id - the ID of the token name to getjava.lang.IllegalArgumentException - if an unknown token ID was specified.public static int getTokenId(java.lang.String name)
name - the name of the token ID to getjava.lang.IllegalArgumentException - if an unknown token name was specified.public static java.lang.String getTagName(DetailNode javadocTagSection)
javadocTagSection - to get tag name from.public static java.lang.String escapeAllControlChars(java.lang.String text)
text - the String to process.public static boolean isCorrectJavadocPosition(DetailAST blockComment)
From Javadoc util documentation: "Placement of comments - Documentation comments are recognized only when placed immediately before class, interface, constructor, method, field or annotation field declarations -- see the class example, method example, and field example. Documentation comments placed in the body of a method are ignored."
If there are many documentation comments per declaration statement, only the last one will be recognized.
blockComment - Block comment ASTCopyright © 2001-2022. All Rights Reserved.