[MNG-2406] add @since tag to plugin descriptor and report

Submitted by: Edwin Punzalan


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@417931 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2006-06-29 03:59:55 +00:00
parent f65a24ac78
commit b1e0e3b6f0
3 changed files with 66 additions and 7 deletions

View File

@ -44,6 +44,8 @@ public class Parameter
private Requirement requirement; private Requirement requirement;
private String since;
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// //
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -172,4 +174,14 @@ public void setImplementation( String implementation )
{ {
this.implementation = implementation; this.implementation = implementation;
} }
public String getSince()
{
return since;
}
public void setSince( String since )
{
this.since = since;
}
} }

View File

@ -318,6 +318,12 @@ private void writeGoalParameterTable( MojoDescriptor mojoDescriptor, XMLWriter w
w.startElement( "th" ); w.startElement( "th" );
w.writeText( "Since" );
w.endElement(); // th
w.startElement( "th" );
w.writeText( "Description" ); w.writeText( "Description" );
w.endElement(); // th w.endElement(); // th
@ -442,6 +448,28 @@ else if ( parameter.getRequirement() != null )
w.startElement( "td" ); w.startElement( "td" );
w.startElement( "code" );
String since = parameter.getSince();
if ( StringUtils.isNotEmpty( since ) )
{
w.writeText( since );
}
else
{
w.writeText( "-" );
}
w.endElement(); // code
w.endElement(); // td
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
w.startElement( "td" );
if ( StringUtils.isNotEmpty( parameter.getDescription() ) ) if ( StringUtils.isNotEmpty( parameter.getDescription() ) )
{ {
w.writeMarkup( parameter.getDescription() ); w.writeMarkup( parameter.getDescription() );

View File

@ -59,6 +59,10 @@ public class JavaMojoDescriptorExtractor
public static final String PARAMETER_DEFAULT_VALUE = "default-value"; public static final String PARAMETER_DEFAULT_VALUE = "default-value";
public static final String PARAMETER_ALIAS = "alias";
public static final String SINCE = "since";
/** /**
* This defines the default implementation in the case the parameter type is an interface. * This defines the default implementation in the case the parameter type is an interface.
*/ */
@ -88,6 +92,12 @@ public class JavaMojoDescriptorExtractor
public static final String EXECUTE = "execute"; public static final String EXECUTE = "execute";
public static final String EXECUTE_LIFECYCLE = "lifecycle";
public static final String EXECUTE_PHASE = "phase";
public static final String EXECUTE_GOAL = "goal";
public static final String GOAL_DESCRIPTION = "description"; public static final String GOAL_DESCRIPTION = "description";
public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution"; public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution";
@ -108,6 +118,10 @@ public class JavaMojoDescriptorExtractor
private static final String COMPONENT = "component"; private static final String COMPONENT = "component";
private static final String COMPONENT_ROLE = "role";
private static final String COMPONENT_ROLEHINT = "roleHint";
protected void validateParameter( Parameter parameter, int i ) protected void validateParameter( Parameter parameter, int i )
throws InvalidParameterException throws InvalidParameterException
{ {
@ -214,8 +228,8 @@ private MojoDescriptor createMojoDescriptor( JavaSource javaSource, PluginDescri
if ( execute != null ) if ( execute != null )
{ {
String executePhase = execute.getNamedParameter( "phase" ); String executePhase = execute.getNamedParameter( EXECUTE_PHASE );
String executeGoal = execute.getNamedParameter( "goal" ); String executeGoal = execute.getNamedParameter( EXECUTE_GOAL );
if ( executePhase == null && executeGoal == null ) if ( executePhase == null && executeGoal == null )
{ {
@ -229,7 +243,7 @@ else if ( executePhase != null && executeGoal != null )
mojoDescriptor.setExecutePhase( executePhase ); mojoDescriptor.setExecutePhase( executePhase );
mojoDescriptor.setExecuteGoal( executeGoal ); mojoDescriptor.setExecuteGoal( executeGoal );
String lifecycle = execute.getNamedParameter( "lifecycle" ); String lifecycle = execute.getNamedParameter( EXECUTE_LIFECYCLE );
if ( lifecycle != null ) if ( lifecycle != null )
{ {
@ -363,14 +377,14 @@ private void extractParameters( MojoDescriptor mojoDescriptor, JavaClass javaCla
if ( componentTag != null ) if ( componentTag != null )
{ {
String role = componentTag.getNamedParameter( "role" ); String role = componentTag.getNamedParameter( COMPONENT_ROLE );
if ( role == null ) if ( role == null )
{ {
role = field.getType().toString(); role = field.getType().toString();
} }
String roleHint = componentTag.getNamedParameter( "roleHint" ); String roleHint = componentTag.getNamedParameter( COMPONENT_ROLEHINT );
pd.setRequirement( new Requirement( role, roleHint ) ); pd.setRequirement( new Requirement( role, roleHint ) );
@ -412,7 +426,13 @@ private void extractParameters( MojoDescriptor mojoDescriptor, JavaClass javaCla
pd.setDeprecated( deprecationTag.getValue() ); pd.setDeprecated( deprecationTag.getValue() );
} }
String alias = parameter.getNamedParameter( "alias" ); DocletTag sinceTag = field.getTagByName( SINCE );
if ( sinceTag != null )
{
pd.setSince( sinceTag.getValue() );
}
String alias = parameter.getNamedParameter( PARAMETER_ALIAS );
if ( !StringUtils.isEmpty( alias ) ) if ( !StringUtils.isEmpty( alias ) )
{ {
@ -429,7 +449,6 @@ private void extractParameters( MojoDescriptor mojoDescriptor, JavaClass javaCla
pd.setDefaultValue( parameter.getNamedParameter( PARAMETER_DEFAULT_VALUE ) ); pd.setDefaultValue( parameter.getNamedParameter( PARAMETER_DEFAULT_VALUE ) );
pd.setImplementation( parameter.getNamedParameter( PARAMETER_IMPLEMENTATION ) ); pd.setImplementation( parameter.getNamedParameter( PARAMETER_IMPLEMENTATION ) );
} }
mojoDescriptor.addParameter( pd ); mojoDescriptor.addParameter( pd );