Class ModuleJavadocParsingUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.site.ModuleJavadocParsingUtil
Utility class for parsing javadocs of modules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionA set of all html tags that need to be considered as text formatting for this macro.static final String
A newline with 10 spaces of indentation.static final String
A newline with 12 spaces of indentation.static final String
A newline with 14 spaces of indentation.static final String
A newline with 16 spaces of indentation.static final String
A newline with 18 spaces of indentation.static final String
A newline with 20 spaces of indentation.static final String
A newline with 8 spaces of indentation.static final String
New line escape character.static final String
"Notes:" javadoc marking.static final Pattern
"Notes:" line.static final Pattern
"Notes:" line with new line accounted. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
getDescriptionEndIndex
(DetailNode moduleJavadoc, Set<String> propertyNamesSet) Gets the end index of the description.static Optional<DetailNode>
getLiTagNode
(DetailNode htmlElement) Gets the node of Li HTML tag.static String
getModuleDescription
(DetailNode moduleJavadoc, Set<String> propertyNames) Gets the description of module from module javadoc.static String
getModuleNotes
(DetailNode moduleJavadoc, Set<String> propertyNames) Gets the Notes section of module from module javadoc.static int
getModuleSinceVersionTagStartIndex
(DetailNode moduleJavadoc) Gets the starting index of the "@since" version tag in module's javadoc.static int
getNotesEndIndex
(DetailNode moduleJavadoc, Set<String> propertyNamesSet) Gets the end index of the Notes.static int
getNotesSectionStartIndex
(DetailNode moduleJavadoc) Gets the start index of the Notes section.static int
getParentSectionStartIndex
(DetailNode moduleJavadoc) Gets the starting index of the "Parent is" paragraph in module's javadoc.getPropertyNames
(String moduleName) Gets properties of the specified module.static int
getPropertySectionStartIndex
(DetailNode moduleJavadoc, Set<String> propertyNames) Gets the start index of property section in module's javadoc.static boolean
isPropertySpecialTokenProp
(Field propertyField) Checks whether property is to contain tokens.private static boolean
isStartOfNotesSection
(DetailNode htmlElement) Determines whether the given HTML node marks the start of the "Notes" section.static boolean
Checks if given line starts with HTML text-formatting tag.static void
writeOutJavadocPortion
(String javadocPortion, org.apache.maven.doxia.sink.Sink sink) Writes the given javadoc chunk into xdoc.
-
Field Details
-
NEWLINE
New line escape character. -
INDENT_LEVEL_8
A newline with 8 spaces of indentation. -
INDENT_LEVEL_10
A newline with 10 spaces of indentation. -
INDENT_LEVEL_12
A newline with 12 spaces of indentation. -
INDENT_LEVEL_14
A newline with 14 spaces of indentation. -
INDENT_LEVEL_16
A newline with 16 spaces of indentation. -
INDENT_LEVEL_18
A newline with 18 spaces of indentation. -
INDENT_LEVEL_20
A newline with 20 spaces of indentation. -
HTML_TEXT_FORMAT_TAGS
A set of all html tags that need to be considered as text formatting for this macro. -
NOTES
"Notes:" javadoc marking.- See Also:
-
NOTES_LINE
"Notes:" line. -
NOTES_LINE_WITH_NEWLINE
"Notes:" line with new line accounted.
-
-
Constructor Details
-
ModuleJavadocParsingUtil
private ModuleJavadocParsingUtil()Private utility constructor.
-
-
Method Details
-
getPropertyNames
public static Set<String> getPropertyNames(String moduleName) throws org.apache.maven.doxia.macro.MacroExecutionException Gets properties of the specified module.- Parameters:
moduleName
- name of module.- Returns:
- set of properties name if present, otherwise null.
- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
- if the module could not be retrieved.
-
isStartOfNotesSection
Determines whether the given HTML node marks the start of the "Notes" section.- Parameters:
htmlElement
- html element to check.- Returns:
- true if the element starts the "Notes" section, false otherwise.
-
getLiTagNode
Gets the node of Li HTML tag.- Parameters:
htmlElement
- html element to get li tag from.- Returns:
- Optional of li tag node.
-
writeOutJavadocPortion
public static void writeOutJavadocPortion(String javadocPortion, org.apache.maven.doxia.sink.Sink sink) Writes the given javadoc chunk into xdoc.- Parameters:
javadocPortion
- javadoc text.sink
- sink of the macro.
-
startsWithTextFormattingHtmlTag
Checks if given line starts with HTML text-formatting tag.- Parameters:
line
- line to check on.- Returns:
- whether given line starts with HTML text-formatting tag.
-
getModuleDescription
Gets the description of module from module javadoc.- Parameters:
moduleJavadoc
- module javadoc.propertyNames
- property names set.- Returns:
- module description.
-
getDescriptionEndIndex
Gets the end index of the description.- Parameters:
moduleJavadoc
- javadoc of module.propertyNamesSet
- Set with property names.- Returns:
- the end index.
-
getNotesSectionStartIndex
Gets the start index of the Notes section.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index.
-
getPropertySectionStartIndex
Gets the start index of property section in module's javadoc.- Parameters:
moduleJavadoc
- javadoc of module.propertyNames
- set with property names.- Returns:
- index of property section.
-
getParentSectionStartIndex
Gets the starting index of the "Parent is" paragraph in module's javadoc.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index of parent subsection.
-
getModuleSinceVersionTagStartIndex
Gets the starting index of the "@since" version tag in module's javadoc.- Parameters:
moduleJavadoc
- javadoc of module.- Returns:
- start index of "@since".
-
getModuleNotes
Gets the Notes section of module from module javadoc.- Parameters:
moduleJavadoc
- module javadoc.propertyNames
- property names set.- Returns:
- Notes section of module.
-
getNotesEndIndex
Gets the end index of the Notes.- Parameters:
moduleJavadoc
- javadoc of module.propertyNamesSet
- Set with property names.- Returns:
- the end index.
-
isPropertySpecialTokenProp
Checks whether property is to contain tokens.- Parameters:
propertyField
- property field.- Returns:
- true if property is to contain tokens, false otherwise.
-