Class SiteUtil.DescriptionExtractor
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.site.SiteUtil.DescriptionExtractor
-
- Enclosing class:
- SiteUtil
private static final class SiteUtil.DescriptionExtractor extends Object
Utility class for extracting description from a method's Javadoc.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
DescriptionExtractor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static String
getDescriptionFromJavadoc(DetailNode javadoc, String moduleName)
Extracts the description from the javadoc detail node.private static List<DetailNode>
getDescriptionNodes(DetailNode javadoc)
Extracts description nodes from javadoc.private static void
handleInternalLink(StringBuilder description, String moduleName, String value)
Converts the href value to a relative link to the document and appends it to the description.private static boolean
isEndOfDescription(DetailNode child)
Determines if the given child index is the end of the description.
-
-
-
Constructor Detail
-
DescriptionExtractor
private DescriptionExtractor()
-
-
Method Detail
-
getDescriptionFromJavadoc
private static String getDescriptionFromJavadoc(DetailNode javadoc, String moduleName) throws org.apache.maven.doxia.macro.MacroExecutionException
Extracts the description from the javadoc detail node. Performs a DFS traversal on the detail node and extracts the text nodes.- Parameters:
javadoc
- the Javadoc to extract the description from.moduleName
- the name of the module.- Returns:
- the description of the setter.
- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
- if the description could not be extracted.
-
handleInternalLink
private static void handleInternalLink(StringBuilder description, String moduleName, String value) throws org.apache.maven.doxia.macro.MacroExecutionException
Converts the href value to a relative link to the document and appends it to the description.- Parameters:
description
- the description to append the relative link to.moduleName
- the name of the module.value
- the href value.- Throws:
org.apache.maven.doxia.macro.MacroExecutionException
- if the relative link could not be created.
-
getDescriptionNodes
private static List<DetailNode> getDescriptionNodes(DetailNode javadoc)
Extracts description nodes from javadoc.- Parameters:
javadoc
- the Javadoc to extract the description from.- Returns:
- the description nodes of the setter.
-
isEndOfDescription
private static boolean isEndOfDescription(DetailNode child)
Determines if the given child index is the end of the description. The end of the description is defined as 4 consecutive nodes of type NEWLINE, LEADING_ASTERISK, NEWLINE, LEADING_ASTERISK. This is an asterisk that is alone on a line. Just like the one below this line.- Parameters:
child
- the child to check.- Returns:
- true if the given child index is the end of the description.
-
-