code simplification

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1342928 13f79535-47bb-0310-9956-ffa450edef68
master
Herve Boutemy 2012-05-26 17:12:27 +00:00
parent a50582836c
commit 46532f2300
2 changed files with 11 additions and 18 deletions

View File

@ -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

View File

@ -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 );
}