Class GeneratorUtils
java.lang.Object
org.apache.maven.tools.plugin.generator.GeneratorUtils
Convenience methods to play with Maven plugins.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
ParserCallback implementation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static String
decodeJavadocTags
(String description) Decodes javadoc inline tags into equivalent HTML tags.static String
discoverPackageName
(org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) Find the best package name, based on the number of hits of actual Mojo classes.static void
static void
private static String
Returns a literal replacementString
for the specifiedString
.static List<org.codehaus.plexus.component.repository.ComponentDependency>
toComponentDependencies
(List<org.apache.maven.model.Dependency> dependencies) static String
Converts a HTML fragment as extracted from a javadoc comment to a plain text string.static void
writeDependencies
(org.codehaus.plexus.util.xml.XMLWriter w, org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
-
Constructor Details
-
GeneratorUtils
private GeneratorUtils()
-
-
Method Details
-
writeDependencies
public static void writeDependencies(org.codehaus.plexus.util.xml.XMLWriter w, org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) - Parameters:
w
- not null writerpluginDescriptor
- not null
-
element
- Parameters:
w
- not null writername
- not nullvalue
- could be null
-
element
-
toComponentDependencies
public static List<org.codehaus.plexus.component.repository.ComponentDependency> toComponentDependencies(List<org.apache.maven.model.Dependency> dependencies) - Parameters:
dependencies
- not null list ofDependency
- Returns:
- list of component dependencies
-
quoteReplacement
Returns a literal replacementString
for the specifiedString
. This method produces aString
that will work as a literal replacements
in theappendReplacement
method of theMatcher
class. TheString
produced will match the sequence of characters ins
treated as a literal sequence. Slashes ('\') and dollar signs ('$') will be given no special meaning. TODO: copied from Matcher class of Java 1.5, remove once target platform can be upgraded- Parameters:
s
- The string to be literalized- Returns:
- A literal string replacement
- See Also:
-
decodeJavadocTags
Decodes javadoc inline tags into equivalent HTML tags. For instance, the inline tag "<A&B>
" should be rendered as "<A&B>
".- Parameters:
description
- The javadoc description to decode, may benull
.- Returns:
- The decoded description, never
null
.
-
toText
Converts a HTML fragment as extracted from a javadoc comment to a plain text string. This method tries to retain as much of the text formatting as possible by means of the following transformations:- List items are converted to leading tabs (U+0009), followed by the item number/bullet, another tab and finally the item contents. Each tab denotes an increase of indentation.
- Flow breaking elements as well as literal line terminators in preformatted text are converted to a newline (U+000A) to denote a mandatory line break.
- Consecutive spaces and line terminators from character data outside of preformatted text will be normalized to a single space. The resulting space denotes a possible point for line wrapping.
- Each space in preformatted text will be converted to a non-breaking space (U+00A0).
- Parameters:
html
- The HTML fragment to convert to plain text, may benull
.- Returns:
- A string with HTML tags converted into pure text, never
null
. - Since:
- 2.4.3
-
discoverPackageName
public static String discoverPackageName(org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor) Find the best package name, based on the number of hits of actual Mojo classes.- Parameters:
pluginDescriptor
- not null- Returns:
- the best name of the package for the generated mojo
-