code formatting
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1405094 13f79535-47bb-0310-9956-ffa450edef68master
parent
0ba0555964
commit
a757bee927
|
|
@ -148,7 +148,8 @@ public class HelpMojo
|
|||
append( sb, "", 0 );
|
||||
}
|
||||
|
||||
for (Node mojo : mojos) {
|
||||
for ( Node mojo : mojos )
|
||||
{
|
||||
writeGoal( sb, goalPrefix, (Element) mojo );
|
||||
}
|
||||
|
||||
|
|
@ -164,11 +165,15 @@ public class HelpMojo
|
|||
return string != null && string.length() > 0;
|
||||
}
|
||||
|
||||
private String getValue(Node node, String elementName) throws MojoExecutionException {
|
||||
private String getValue( Node node, String elementName )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
return getSingleChild( node, elementName ).getTextContent();
|
||||
}
|
||||
|
||||
private Node getSingleChild(Node node, String elementName) throws MojoExecutionException {
|
||||
private Node getSingleChild( Node node, String elementName )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
List<Node> namedChild = findNamedChild( node, elementName );
|
||||
if ( namedChild.isEmpty() )
|
||||
{
|
||||
|
|
@ -182,20 +187,24 @@ public class HelpMojo
|
|||
return node1;
|
||||
}
|
||||
|
||||
private List<Node> findNamedChild(Node node, String elementName){
|
||||
private List<Node> findNamedChild( Node node, String elementName )
|
||||
{
|
||||
List<Node> result = new ArrayList<Node>();
|
||||
NodeList childNodes = node.getChildNodes();
|
||||
for (int i = 0; i < childNodes.getLength(); i++){
|
||||
for ( int i = 0; i < childNodes.getLength(); i++ )
|
||||
{
|
||||
Node item = childNodes.item( i );
|
||||
if (elementName.equals(item.getNodeName())){
|
||||
if ( elementName.equals( item.getNodeName() ) )
|
||||
{
|
||||
result.add( item );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private Node findSingleChild(Node node, String elementName) throws MojoExecutionException {
|
||||
private Node findSingleChild( Node node, String elementName )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
List<Node> elementsByTagName = findNamedChild( node, elementName );
|
||||
if ( elementsByTagName.isEmpty() )
|
||||
{
|
||||
|
|
@ -208,7 +217,9 @@ public class HelpMojo
|
|||
return elementsByTagName.get( 0 );
|
||||
}
|
||||
|
||||
private void writeGoal( StringBuilder sb, String goalPrefix, Element mojo ) throws MojoExecutionException {
|
||||
private void writeGoal( StringBuilder sb, String goalPrefix, Element mojo )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
String mojoGoal = getValue( mojo, "goal" );
|
||||
Node configurationElement = findSingleChild( mojo, "configuration" );
|
||||
|
||||
|
|
@ -238,14 +249,17 @@ public class HelpMojo
|
|||
append( sb, "Available parameters:", 1 );
|
||||
append( sb, "", 0 );
|
||||
|
||||
for (Node parameter : parameters) {
|
||||
for ( Node parameter : parameters )
|
||||
{
|
||||
writeParameter( sb, parameter, configurationElement );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement ) throws MojoExecutionException {
|
||||
private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
String parameterName = getValue( parameter, "name" );
|
||||
String parameterDescription = getValue( parameter, "description" );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue