public final class JavadocPropertiesGenerator extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
JavadocPropertiesGenerator.CliOptions
Helper class encapsulating the command line options and positional parameters.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.util.regex.Pattern |
END_OF_SENTENCE_PATTERN
This regexp is used to extract the first sentence from the text.
|
private static int |
USAGE_HELP_WIDTH
Max width of the usage help message for this command.
|
| Modifier | Constructor and Description |
|---|---|
private |
JavadocPropertiesGenerator()
Don't create instance of this class, use the
main(String[]) method instead. |
| Modifier and Type | Method and Description |
|---|---|
private static void |
formatHtmlElement(java.lang.StringBuilder builder,
DetailNode node)
Concatenates the HTML text from AST of a JavadocTokenTypes.HTML_ELEMENT.
|
private static void |
formatInlineCodeTag(java.lang.StringBuilder builder,
DetailNode inlineTag)
Converts inline code tag into HTML form.
|
private static DetailAST |
getClassBody(DetailAST top)
Finds the class body of the first class in the DetailAST.
|
private static java.lang.String |
getFirstJavadocSentence(DetailAST ast)
Extracts the first sentence as HTML formatted text from the comment of an DetailAST.
|
private static java.lang.String |
getFirstJavadocSentence(DetailNode tree)
Extracts the first sentence as HTML formatted text from a DetailNode.
|
private static java.lang.String |
getName(DetailAST ast)
Extracts the name of an ast.
|
private static boolean |
isPublicStaticFinalIntField(DetailAST ast)
Checks that the DetailAST is a
public static final int field. |
private static void |
iteratePublicStaticIntFields(DetailAST objBlock,
java.util.function.Consumer<java.lang.String> consumer)
Walks over the type members and push the first javadoc sentence of every
public static int field to the consumer. |
static void |
main(java.lang.String... args)
TokenTypes.properties generator entry point.
|
private static void |
writePropertiesFile(JavadocPropertiesGenerator.CliOptions options)
Creates the .properties file from a .java file.
|
private static final java.util.regex.Pattern END_OF_SENTENCE_PATTERN
private static final int USAGE_HELP_WIDTH
private JavadocPropertiesGenerator()
main(String[]) method instead.public static void main(java.lang.String... args) throws CheckstyleException
args - the command line argumentsCheckstyleException - if parser or lexer failed or if there is an IO problemprivate static void writePropertiesFile(JavadocPropertiesGenerator.CliOptions options) throws CheckstyleException
options - the user-specified optionsCheckstyleException - if a javadoc comment can not be parsedprivate static void iteratePublicStaticIntFields(DetailAST objBlock, java.util.function.Consumer<java.lang.String> consumer) throws CheckstyleException
public static int field to the consumer.objBlock - the OBJBLOCK of a class to iterate over its membersconsumer - first javadoc sentence consumerCheckstyleException - if failed to parse a javadoc commentprivate static DetailAST getClassBody(DetailAST top)
top - AST to find the class bodynull otherwiseprivate static boolean isPublicStaticFinalIntField(DetailAST ast)
public static final int field.ast - to processtrue if matches; false otherwiseprivate static java.lang.String getName(DetailAST ast)
ast - to extract the nameTokenTypes.IDENT nodeprivate static java.lang.String getFirstJavadocSentence(DetailAST ast) throws CheckstyleException
ast - to extract the first sentenceTokenTypes.BLOCK_COMMENT_BEGIN node
or null if the first sentence is absent or malformed (does not end with period)CheckstyleException - if a javadoc comment can not be parsed or an unsupported inline
tag foundprivate static java.lang.String getFirstJavadocSentence(DetailNode tree) throws CheckstyleException
tree - to extract the first sentencenull if the first sentence is absent or
malformed (does not end with any of the end-of-sentence markers)CheckstyleException - if an unsupported inline tag foundprivate static void formatInlineCodeTag(java.lang.StringBuilder builder, DetailNode inlineTag) throws CheckstyleException
builder - to appendinlineTag - to formatCheckstyleException - if the inline javadoc tag is not a literal nor a code tagprivate static void formatHtmlElement(java.lang.StringBuilder builder, DetailNode node)
builder - to appendnode - to formatCopyright © 2001-2022. All Rights Reserved.