org.apache.maven.tools.plugin.generator
Class GeneratorUtils

java.lang.Object
  extended by org.apache.maven.tools.plugin.generator.GeneratorUtils

public final class GeneratorUtils
extends Object

Convenience methods to play with Maven plugins.

Version:
$Id: GeneratorUtils.java 1342928 2012-05-26 17:12:27Z hboutemy $
Author:
jdcasey

Method Summary
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 element(org.codehaus.plexus.util.xml.XMLWriter w, String name, String value)
           
static void element(org.codehaus.plexus.util.xml.XMLWriter w, String name, String value, boolean asText)
           
static boolean isMavenReport(String impl, org.apache.maven.project.MavenProject project)
           
static String makeHtmlValid(String description)
          Fixes some javadoc comment to become a valid XHTML snippet.
static List<org.codehaus.plexus.component.repository.ComponentDependency> toComponentDependencies(List<org.apache.maven.model.Dependency> dependencies)
           
static String toText(String html)
          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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeDependencies

public static void writeDependencies(org.codehaus.plexus.util.xml.XMLWriter w,
                                     org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor)
Parameters:
w - not null writer
pluginDescriptor - not null

element

public static void element(org.codehaus.plexus.util.xml.XMLWriter w,
                           String name,
                           String value)
Parameters:
w - not null writer
name - not null
value - could be null

element

public static void element(org.codehaus.plexus.util.xml.XMLWriter w,
                           String name,
                           String value,
                           boolean asText)

toComponentDependencies

public static List<org.codehaus.plexus.component.repository.ComponentDependency> toComponentDependencies(List<org.apache.maven.model.Dependency> dependencies)
Parameters:
dependencies - not null list of Dependency
Returns:
list of component dependencies

makeHtmlValid

public static String makeHtmlValid(String description)
Fixes some javadoc comment to become a valid XHTML snippet.

Parameters:
description - Javadoc description with HTML tags, may be null.
Returns:
The description with valid XHTML tags, never null.

toText

public static String toText(String html)
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:

Parameters:
html - The HTML fragment to convert to plain text, may be null.
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

isMavenReport

public static boolean isMavenReport(String impl,
                                    org.apache.maven.project.MavenProject project)
                             throws IllegalArgumentException
Parameters:
impl - a Mojo implementation, not null
project - a MavenProject instance, could be null
Returns:
true is the Mojo implementation implements MavenReport, false otherwise.
Throws:
IllegalArgumentException - if any


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.