public final class JavadocUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
JavadocUtils.JavadocTagType
The type of Javadoc tag we want returned.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
BLOCK_TAG_PATTERN
Block tag pattern.
|
private static java.util.regex.Pattern |
BLOCK_TAG_PATTERN_FIRST_LINE
Block tag pattern for a first line.
|
private static java.util.regex.Pattern |
COMMENT_PATTERN
Comment pattern.
|
private static java.util.regex.Pattern |
INLINE_TAG_PATTERN
Inline tag pattern.
|
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 com.google.common.collect.ImmutableMap<java.lang.String,java.lang.Integer> |
TOKEN_NAME_TO_VALUE
Maps from a token name to value.
|
private static 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 |
JavadocUtils()
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.
|
private static java.lang.String |
getBlockCommentContent(DetailAST blockCommentBegin)
Gets content of block comment.
|
private static java.util.regex.Pattern |
getBlockTagPattern(int lineNumber)
Get a block tag pattern depending on a line number of a javadoc.
|
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,
JavadocUtils.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 void |
lookForInlineTags(TextBlock comment,
int lineNumber,
java.util.List<JavadocTag> validTags,
java.util.List<InvalidJavadocTag> invalidTags)
Looks for inline tags in comment and adds them to the proper tags collection.
|
private static final com.google.common.collect.ImmutableMap<java.lang.String,java.lang.Integer> TOKEN_NAME_TO_VALUE
private static final 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 COMMENT_PATTERN
private static final java.util.regex.Pattern BLOCK_TAG_PATTERN_FIRST_LINE
private static final java.util.regex.Pattern BLOCK_TAG_PATTERN
private static final java.util.regex.Pattern INLINE_TAG_PATTERN
private static final java.util.regex.Pattern NEWLINE
private static final java.util.regex.Pattern RETURN
private static final java.util.regex.Pattern TAB
public static JavadocTags getJavadocTags(TextBlock textBlock, JavadocUtils.JavadocTagType tagType)
textBlock
- the Javadoc comment to process.tagType
- the type of validTags we're interested inprivate static java.util.regex.Pattern getBlockTagPattern(int lineNumber)
lineNumber
- the line number.private static void lookForInlineTags(TextBlock comment, int lineNumber, java.util.List<JavadocTag> validTags, java.util.List<InvalidJavadocTag> invalidTags)
comment
- comment text blocklineNumber
- line number in the commentvalidTags
- collection of valid tagsinvalidTags
- collection of invalid tagspublic static boolean isJavadocComment(java.lang.String commentContent)
commentContent
- content of block commentpublic static boolean isJavadocComment(DetailAST blockCommentBegin)
blockCommentBegin
- block comment ASTprivate 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 getpublic static int getTokenId(java.lang.String name)
name
- the name of the token ID to getpublic 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)
blockComment
- Block comment AST