Author: hboutemy
Date: Sat May 26 17:12:27 2012
New Revision: 1342928

URL: http://svn.apache.org/viewvc?rev=1342928&view=rev
Log:
code simplification

Modified:
    
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
    
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java

Modified: 
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
URL: 
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java?rev=1342928&r1=1342927&r2=1342928&view=diff
==============================================================================
--- 
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
 (original)
+++ 
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java
 Sat May 26 17:12:27 2012
@@ -113,6 +113,11 @@ public final class GeneratorUtils
         w.endElement();
     }
 
+    public static void element( XMLWriter w, String name, String value, 
boolean asText )
+    {
+        element( w, name, asText ? GeneratorUtils.toText( value ) : value );
+    }
+    
     /**
      * @param dependencies not null list of <code>Dependency</code>
      * @return list of component dependencies

Modified: 
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL: 
http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=1342928&r1=1342927&r2=1342928&view=diff
==============================================================================
--- 
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
 (original)
+++ 
maven/plugin-tools/trunk/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
 Sat May 26 17:12:27 2012
@@ -146,14 +146,8 @@ public class PluginDescriptorGenerator
             w.startElement( "plugin" );
 
             GeneratorUtils.element( w, "name", pluginDescriptor.getName() );
-            if ( helpDescriptor )
-            {
-                GeneratorUtils.element( w, "description", 
GeneratorUtils.toText( pluginDescriptor.getDescription() ) );
-            }
-            else
-            {
-                GeneratorUtils.element( w, "description", 
pluginDescriptor.getDescription() );
-            }
+
+            GeneratorUtils.element( w, "description", 
pluginDescriptor.getDescription(), helpDescriptor );
 
             GeneratorUtils.element( w, "groupId", 
pluginDescriptor.getGroupId() );
 
@@ -475,17 +469,11 @@ public class PluginDescriptorGenerator
                     GeneratorUtils.element( w, "required", Boolean.toString( 
parameter.isRequired() ) );
 
                     GeneratorUtils.element( w, "editable", Boolean.toString( 
parameter.isEditable() ) );
-                    if ( helpDescriptor )
-                    {
-                        GeneratorUtils.element( w, "description", 
GeneratorUtils.toText( parameter.getDescription() ) );
-                    }
-                    else
-                    {
-                        GeneratorUtils.element( w, "description", 
parameter.getDescription() );
-                    }
 
-                    if ( StringUtils.isNotEmpty( parameter.getDefaultValue() ) 
|| StringUtils.isNotEmpty(
-                        parameter.getExpression() ) )
+                    GeneratorUtils.element( w, "description", 
parameter.getDescription(), helpDescriptor );
+
+                    if ( StringUtils.isNotEmpty( parameter.getDefaultValue() )
+                        || StringUtils.isNotEmpty( parameter.getExpression() ) 
)
                     {
                         configuration.add( parameter );
                     }


Reply via email to