o Unified inheritance hierarchy of POM model classes

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1059189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2011-01-14 22:33:29 +00:00
parent cce679c0c9
commit 45d1e985aa
2 changed files with 39 additions and 100 deletions

View File

@ -1320,8 +1320,7 @@ public class ModelMerger
protected void mergeReportPlugin( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
Map<Object, Object> context )
{
mergeReportPlugin_Inherited( target, source, sourceDominant, context );
mergeReportPlugin_Configuration( target, source, sourceDominant, context );
mergeConfigurationContainer( target, source, sourceDominant, context );
mergeReportPlugin_GroupId( target, source, sourceDominant, context );
mergeReportPlugin_ArtifactId( target, source, sourceDominant, context );
mergeReportPlugin_Version( target, source, sourceDominant, context );
@ -1370,39 +1369,6 @@ public class ModelMerger
}
}
protected void mergeReportPlugin_Inherited( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getInherited();
if ( src != null )
{
if ( sourceDominant || target.getInherited() == null )
{
target.setInherited( src );
target.setLocation( "inherited", source.getLocation( "inherited" ) );
}
}
}
protected void mergeReportPlugin_Configuration( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
Map<Object, Object> context )
{
Xpp3Dom src = (Xpp3Dom) source.getConfiguration();
if ( src != null )
{
Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration();
if ( sourceDominant || tgt == null )
{
tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt );
}
else
{
tgt = Xpp3Dom.mergeXpp3Dom( tgt, src );
}
target.setConfiguration( tgt );
}
}
protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
Map<Object, Object> context )
{
@ -1431,6 +1397,42 @@ public class ModelMerger
}
}
protected void mergeReportSet( ReportSet target, ReportSet source, boolean sourceDominant,
Map<Object, Object> context )
{
mergeConfigurationContainer( target, source, sourceDominant, context );
mergeReportSet_Id( target, source, sourceDominant, context );
mergeReportSet_Reports( target, source, sourceDominant, context );
}
protected void mergeReportSet_Id( ReportSet target, ReportSet source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getId();
if ( src != null )
{
if ( sourceDominant || target.getId() == null )
{
target.setId( src );
target.setLocation( "id", source.getLocation( "id" ) );
}
}
}
protected void mergeReportSet_Reports( ReportSet target, ReportSet source, boolean sourceDominant,
Map<Object, Object> context )
{
List<String> src = source.getReports();
if ( !src.isEmpty() )
{
List<String> tgt = target.getReports();
List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
merged.addAll( tgt );
merged.addAll( src );
target.setReports( merged );
}
}
protected void mergeDependencyManagement( DependencyManagement target, DependencyManagement source,
boolean sourceDominant, Map<Object, Object> context )
{

View File

@ -3261,6 +3261,7 @@
<class xml.tagName="plugin" java.clone="deep">
<name>ReportPlugin</name>
<version>4.0.0</version>
<superClass>ConfigurationContainer</superClass>
<description>
<![CDATA[
The <code>&lt;plugin&gt;</code> element contains informations required for a report plugin.
@ -3288,25 +3289,6 @@
<description>The version of the reporting plugin to be used.</description>
<type>String</type>
</field>
<field>
<name>inherited</name>
<version>4.0.0</version>
<type>String</type>
<description>
<![CDATA[
Whether the configuration in this plugin should be made available to projects
that inherit from this one. Note: While the type of this field is <code>String</code>
for technical reasons, the semantic type is actually <code>Boolean</code>.
Default value is <code>true</code>.
]]>
</description>
</field>
<field>
<name>configuration</name>
<version>4.0.0</version>
<type>DOM</type>
<description>The configuration of the reporting plugin.</description>
</field>
<field>
<name>reportSets</name>
<version>4.0.0</version>
@ -3376,28 +3358,6 @@
{
return groupId + ":" + artifactId;
}
public boolean isInherited()
{
return ( inherited != null ) ? Boolean.parseBoolean( inherited ) : true;
}
public void setInherited( boolean inherited )
{
this.inherited = String.valueOf( inherited );
}
private boolean inheritanceApplied = true;
public void unsetInheritanceApplied()
{
this.inheritanceApplied = false;
}
public boolean isInheritanceApplied()
{
return inheritanceApplied;
}
]]>
</code>
</codeSegment>
@ -3406,6 +3366,7 @@
<class java.clone="deep">
<name>ReportSet</name>
<version>4.0.0</version>
<superClass>ConfigurationContainer</superClass>
<description>Represents a set of reports and configuration to be used to generate them.</description>
<fields>
<field>
@ -3417,18 +3378,6 @@
</description>
<defaultValue>default</defaultValue>
</field>
<field>
<name>configuration</name>
<version>4.0.0</version>
<description>Configuration of the report to be used when generating this set.</description>
<type>DOM</type>
</field>
<field>
<name>inherited</name>
<version>4.0.0</version>
<type>String</type>
<description>Whether any configuration should be propagated to child POMs.</description>
</field>
<field>
<name>reports</name>
<version>4.0.0</version>
@ -3445,18 +3394,6 @@
<version>4.0.0</version>
<code>
<![CDATA[
private boolean inheritanceApplied = true;
public void unsetInheritanceApplied()
{
this.inheritanceApplied = false;
}
public boolean isInheritanceApplied()
{
return inheritanceApplied;
}
@Override
public String toString()
{