View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //   Generated by Maven, any modifications will be overwritten.
3   // ==============================================================
4   package org.apache.maven.model.v4;
5   
6   import java.io.ObjectStreamException;
7   import java.util.AbstractList;
8   import java.util.ArrayList;
9   import java.util.Collection;
10  import java.util.HashMap;
11  import java.util.Iterator;
12  import java.util.LinkedHashMap;
13  import java.util.List;
14  import java.util.Map;
15  import java.util.Properties;
16  import java.util.Objects;
17  import java.util.function.BinaryOperator;
18  import java.util.function.Function;
19  import java.util.stream.Collectors;
20  
21  import org.apache.maven.api.annotations.Generated;
22  import org.apache.maven.api.xml.Dom;
23  import org.apache.maven.api.model.Model;
24  import org.apache.maven.api.model.ModelBase;
25  import org.apache.maven.api.model.PluginContainer;
26  import org.apache.maven.api.model.PluginConfiguration;
27  import org.apache.maven.api.model.BuildBase;
28  import org.apache.maven.api.model.Build;
29  import org.apache.maven.api.model.CiManagement;
30  import org.apache.maven.api.model.Notifier;
31  import org.apache.maven.api.model.Contributor;
32  import org.apache.maven.api.model.Dependency;
33  import org.apache.maven.api.model.Developer;
34  import org.apache.maven.api.model.Exclusion;
35  import org.apache.maven.api.model.IssueManagement;
36  import org.apache.maven.api.model.DistributionManagement;
37  import org.apache.maven.api.model.License;
38  import org.apache.maven.api.model.MailingList;
39  import org.apache.maven.api.model.Organization;
40  import org.apache.maven.api.model.PatternSet;
41  import org.apache.maven.api.model.Parent;
42  import org.apache.maven.api.model.Scm;
43  import org.apache.maven.api.model.FileSet;
44  import org.apache.maven.api.model.Resource;
45  import org.apache.maven.api.model.RepositoryBase;
46  import org.apache.maven.api.model.Repository;
47  import org.apache.maven.api.model.DeploymentRepository;
48  import org.apache.maven.api.model.RepositoryPolicy;
49  import org.apache.maven.api.model.Site;
50  import org.apache.maven.api.model.ConfigurationContainer;
51  import org.apache.maven.api.model.Plugin;
52  import org.apache.maven.api.model.PluginExecution;
53  import org.apache.maven.api.model.DependencyManagement;
54  import org.apache.maven.api.model.PluginManagement;
55  import org.apache.maven.api.model.Reporting;
56  import org.apache.maven.api.model.Profile;
57  import org.apache.maven.api.model.Activation;
58  import org.apache.maven.api.model.ActivationProperty;
59  import org.apache.maven.api.model.ActivationOS;
60  import org.apache.maven.api.model.ActivationFile;
61  import org.apache.maven.api.model.ReportPlugin;
62  import org.apache.maven.api.model.ReportSet;
63  import org.apache.maven.api.model.Prerequisites;
64  import org.apache.maven.api.model.Relocation;
65  import org.apache.maven.api.model.Extension;
66  import org.apache.maven.api.model.InputLocation;
67  import org.apache.maven.api.model.InputSource;
68  
69  @Generated
70  public class MavenMerger
71  {
72  
73      /**
74       * Merges the specified source object into the given target object.
75       *
76       * @param target The target object whose existing contents should be merged with the source, must not be
77       *            <code>null</code>.
78       * @param source The (read-only) source object that should be merged into the target object, may be
79       *            <code>null</code>.
80       * @param sourceDominant A flag indicating whether either the target object or the source object provides the
81       *            dominant data.
82       * @param hints A set of key-value pairs that customized merger implementations can use to carry domain-specific
83       *            information along, may be <code>null</code>.
84       */
85      public Model merge( Model target, Model source, boolean sourceDominant, Map<?, ?> hints )
86      {
87          Objects.requireNonNull( target, "target cannot be null" );
88          if ( source == null )
89          {
90              return target;
91          }
92          Map<Object, Object> context = new HashMap<>();
93          if ( hints != null )
94          {
95              context.putAll( hints );
96          }
97          return mergeModel( target, source, sourceDominant, context );
98      }
99  
100     protected Model mergeModel( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
101     {
102         Model.Builder builder = Model.newBuilder( target );
103         mergeModel( builder, target, source, sourceDominant, context );
104         return builder.build();
105     }
106 
107     protected void mergeModel( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
108     {
109         mergeModelBase( builder, target ,source, sourceDominant, context );
110         mergeModel_PomFile( builder, target, source, sourceDominant, context );
111         mergeModel_ModelVersion( builder, target, source, sourceDominant, context );
112         mergeModel_Parent( builder, target, source, sourceDominant, context );
113         mergeModel_GroupId( builder, target, source, sourceDominant, context );
114         mergeModel_ArtifactId( builder, target, source, sourceDominant, context );
115         mergeModel_Version( builder, target, source, sourceDominant, context );
116         mergeModel_Packaging( builder, target, source, sourceDominant, context );
117         mergeModel_Name( builder, target, source, sourceDominant, context );
118         mergeModel_Description( builder, target, source, sourceDominant, context );
119         mergeModel_Url( builder, target, source, sourceDominant, context );
120         mergeModel_ChildProjectUrlInheritAppendPath( builder, target, source, sourceDominant, context );
121         mergeModel_InceptionYear( builder, target, source, sourceDominant, context );
122         mergeModel_Organization( builder, target, source, sourceDominant, context );
123         mergeModel_Licenses( builder, target, source, sourceDominant, context );
124         mergeModel_Developers( builder, target, source, sourceDominant, context );
125         mergeModel_Contributors( builder, target, source, sourceDominant, context );
126         mergeModel_MailingLists( builder, target, source, sourceDominant, context );
127         mergeModel_Prerequisites( builder, target, source, sourceDominant, context );
128         mergeModel_Scm( builder, target, source, sourceDominant, context );
129         mergeModel_IssueManagement( builder, target, source, sourceDominant, context );
130         mergeModel_CiManagement( builder, target, source, sourceDominant, context );
131         mergeModel_Build( builder, target, source, sourceDominant, context );
132         mergeModel_Profiles( builder, target, source, sourceDominant, context );
133     }
134 
135     protected void mergeModel_Modules( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
136     {
137         builder.modules( merge( target.getModules(), source.getModules(), sourceDominant, e -> e ) );
138     }
139     protected void mergeModel_DistributionManagement( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
140     {
141         DistributionManagement src = source.getDistributionManagement();
142         if ( src != null )
143         {
144             DistributionManagement tgt = target.getDistributionManagement();
145             if ( tgt == null )
146             {
147                 tgt = DistributionManagement.newInstance( false );
148             }
149             DistributionManagement merged = mergeDistributionManagement( tgt, src, sourceDominant, context );
150             if ( merged == src )
151             {
152                 builder.distributionManagement( merged );
153                 builder.location( "distributionManagement", source.getLocation( "distributionManagement" ) );
154             }
155             else if ( merged != tgt )
156             {
157                 builder.distributionManagement( merged );
158                 builder.location( "distributionManagement", InputLocation.merge( target.getLocation( "distributionManagement" ), source.getLocation( "distributionManagement" ), sourceDominant ) );
159             }
160         }
161     }
162     protected void mergeModel_Properties( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
163     {
164         Map<String, String> src = source.getProperties();
165         if ( !src.isEmpty() )
166         {
167             Map<String, String> tgt = target.getProperties();
168             if ( tgt.isEmpty() )
169             {
170                 builder.properties( src );
171                 builder.location( "properties", source.getLocation( "properties" ) );
172             }
173             else
174             {
175                 Map<String, String> merged = new HashMap<>();
176                 merged.putAll( sourceDominant ? target.getProperties() : source.getProperties() );
177                 merged.putAll( sourceDominant ? source.getProperties() : target.getProperties() );
178                 builder.properties( merged );
179                 builder.location( "properties", InputLocation.merge( target.getLocation( "properties" ), source.getLocation( "properties" ), sourceDominant ) );
180             }
181         }
182     }
183     protected void mergeModel_DependencyManagement( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
184     {
185         DependencyManagement src = source.getDependencyManagement();
186         if ( src != null )
187         {
188             DependencyManagement tgt = target.getDependencyManagement();
189             if ( tgt == null )
190             {
191                 tgt = DependencyManagement.newInstance( false );
192             }
193             DependencyManagement merged = mergeDependencyManagement( tgt, src, sourceDominant, context );
194             if ( merged == src )
195             {
196                 builder.dependencyManagement( merged );
197                 builder.location( "dependencyManagement", source.getLocation( "dependencyManagement" ) );
198             }
199             else if ( merged != tgt )
200             {
201                 builder.dependencyManagement( merged );
202                 builder.location( "dependencyManagement", InputLocation.merge( target.getLocation( "dependencyManagement" ), source.getLocation( "dependencyManagement" ), sourceDominant ) );
203             }
204         }
205     }
206     protected void mergeModel_Dependencies( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
207     {
208         builder.dependencies( merge( target.getDependencies(), source.getDependencies(), sourceDominant, getDependencyKey() ) );
209     }
210     protected void mergeModel_Repositories( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
211     {
212         builder.repositories( merge( target.getRepositories(), source.getRepositories(), sourceDominant, getRepositoryKey() ) );
213     }
214     protected void mergeModel_PluginRepositories( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
215     {
216         builder.pluginRepositories( merge( target.getPluginRepositories(), source.getPluginRepositories(), sourceDominant, getRepositoryKey() ) );
217     }
218     protected void mergeModel_Reporting( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
219     {
220         Reporting src = source.getReporting();
221         if ( src != null )
222         {
223             Reporting tgt = target.getReporting();
224             if ( tgt == null )
225             {
226                 tgt = Reporting.newInstance( false );
227             }
228             Reporting merged = mergeReporting( tgt, src, sourceDominant, context );
229             if ( merged == src )
230             {
231                 builder.reporting( merged );
232                 builder.location( "reporting", source.getLocation( "reporting" ) );
233             }
234             else if ( merged != tgt )
235             {
236                 builder.reporting( merged );
237                 builder.location( "reporting", InputLocation.merge( target.getLocation( "reporting" ), source.getLocation( "reporting" ), sourceDominant ) );
238             }
239         }
240     }
241     protected void mergeModel_PomFile( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
242     {
243         if ( sourceDominant )
244         {
245             builder.pomFile( source.getPomFile() );
246         }
247     }
248     protected void mergeModel_ModelVersion( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
249     {
250         String src = source.getModelVersion();
251         String tgt = target.getModelVersion();
252         if ( src != null && ( sourceDominant || tgt == null ) )
253         {
254             builder.modelVersion( src );
255             builder.location( "modelVersion", source.getLocation( "modelVersion" ) );
256         }
257     }
258     protected void mergeModel_Parent( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
259     {
260         Parent src = source.getParent();
261         if ( src != null )
262         {
263             Parent tgt = target.getParent();
264             if ( tgt == null )
265             {
266                 tgt = Parent.newInstance( false );
267             }
268             Parent merged = mergeParent( tgt, src, sourceDominant, context );
269             if ( merged == src )
270             {
271                 builder.parent( merged );
272                 builder.location( "parent", source.getLocation( "parent" ) );
273             }
274             else if ( merged != tgt )
275             {
276                 builder.parent( merged );
277                 builder.location( "parent", InputLocation.merge( target.getLocation( "parent" ), source.getLocation( "parent" ), sourceDominant ) );
278             }
279         }
280     }
281     protected void mergeModel_GroupId( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
282     {
283         String src = source.getGroupId();
284         String tgt = target.getGroupId();
285         if ( src != null && ( sourceDominant || tgt == null ) )
286         {
287             builder.groupId( src );
288             builder.location( "groupId", source.getLocation( "groupId" ) );
289         }
290     }
291     protected void mergeModel_ArtifactId( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
292     {
293         String src = source.getArtifactId();
294         String tgt = target.getArtifactId();
295         if ( src != null && ( sourceDominant || tgt == null ) )
296         {
297             builder.artifactId( src );
298             builder.location( "artifactId", source.getLocation( "artifactId" ) );
299         }
300     }
301     protected void mergeModel_Version( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
302     {
303         String src = source.getVersion();
304         String tgt = target.getVersion();
305         if ( src != null && ( sourceDominant || tgt == null ) )
306         {
307             builder.version( src );
308             builder.location( "version", source.getLocation( "version" ) );
309         }
310     }
311     protected void mergeModel_Packaging( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
312     {
313         String src = source.getPackaging();
314         String tgt = target.getPackaging();
315         if ( src != null && ( sourceDominant || tgt == null ) )
316         {
317             builder.packaging( src );
318             builder.location( "packaging", source.getLocation( "packaging" ) );
319         }
320     }
321     protected void mergeModel_Name( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
322     {
323         String src = source.getName();
324         String tgt = target.getName();
325         if ( src != null && ( sourceDominant || tgt == null ) )
326         {
327             builder.name( src );
328             builder.location( "name", source.getLocation( "name" ) );
329         }
330     }
331     protected void mergeModel_Description( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
332     {
333         String src = source.getDescription();
334         String tgt = target.getDescription();
335         if ( src != null && ( sourceDominant || tgt == null ) )
336         {
337             builder.description( src );
338             builder.location( "description", source.getLocation( "description" ) );
339         }
340     }
341     protected void mergeModel_Url( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
342     {
343         String src = source.getUrl();
344         String tgt = target.getUrl();
345         if ( src != null && ( sourceDominant || tgt == null ) )
346         {
347             builder.url( src );
348             builder.location( "url", source.getLocation( "url" ) );
349         }
350     }
351     protected void mergeModel_ChildProjectUrlInheritAppendPath( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
352     {
353         String src = source.getChildProjectUrlInheritAppendPath();
354         String tgt = target.getChildProjectUrlInheritAppendPath();
355         if ( src != null && ( sourceDominant || tgt == null ) )
356         {
357             builder.childProjectUrlInheritAppendPath( src );
358             builder.location( "childProjectUrlInheritAppendPath", source.getLocation( "childProjectUrlInheritAppendPath" ) );
359         }
360     }
361     protected void mergeModel_InceptionYear( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
362     {
363         String src = source.getInceptionYear();
364         String tgt = target.getInceptionYear();
365         if ( src != null && ( sourceDominant || tgt == null ) )
366         {
367             builder.inceptionYear( src );
368             builder.location( "inceptionYear", source.getLocation( "inceptionYear" ) );
369         }
370     }
371     protected void mergeModel_Organization( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
372     {
373         Organization src = source.getOrganization();
374         if ( src != null )
375         {
376             Organization tgt = target.getOrganization();
377             if ( tgt == null )
378             {
379                 tgt = Organization.newInstance( false );
380             }
381             Organization merged = mergeOrganization( tgt, src, sourceDominant, context );
382             if ( merged == src )
383             {
384                 builder.organization( merged );
385                 builder.location( "organization", source.getLocation( "organization" ) );
386             }
387             else if ( merged != tgt )
388             {
389                 builder.organization( merged );
390                 builder.location( "organization", InputLocation.merge( target.getLocation( "organization" ), source.getLocation( "organization" ), sourceDominant ) );
391             }
392         }
393     }
394     protected void mergeModel_Licenses( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
395     {
396         builder.licenses( merge( target.getLicenses(), source.getLicenses(), sourceDominant, getLicenseKey() ) );
397     }
398     protected void mergeModel_Developers( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
399     {
400         builder.developers( merge( target.getDevelopers(), source.getDevelopers(), sourceDominant, getDeveloperKey() ) );
401     }
402     protected void mergeModel_Contributors( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
403     {
404         builder.contributors( merge( target.getContributors(), source.getContributors(), sourceDominant, getContributorKey() ) );
405     }
406     protected void mergeModel_MailingLists( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
407     {
408         builder.mailingLists( merge( target.getMailingLists(), source.getMailingLists(), sourceDominant, getMailingListKey() ) );
409     }
410     protected void mergeModel_Prerequisites( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
411     {
412         Prerequisites src = source.getPrerequisites();
413         if ( src != null )
414         {
415             Prerequisites tgt = target.getPrerequisites();
416             if ( tgt == null )
417             {
418                 tgt = Prerequisites.newInstance( false );
419             }
420             Prerequisites merged = mergePrerequisites( tgt, src, sourceDominant, context );
421             if ( merged == src )
422             {
423                 builder.prerequisites( merged );
424                 builder.location( "prerequisites", source.getLocation( "prerequisites" ) );
425             }
426             else if ( merged != tgt )
427             {
428                 builder.prerequisites( merged );
429                 builder.location( "prerequisites", InputLocation.merge( target.getLocation( "prerequisites" ), source.getLocation( "prerequisites" ), sourceDominant ) );
430             }
431         }
432     }
433     protected void mergeModel_Scm( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
434     {
435         Scm src = source.getScm();
436         if ( src != null )
437         {
438             Scm tgt = target.getScm();
439             if ( tgt == null )
440             {
441                 tgt = Scm.newInstance( false );
442             }
443             Scm merged = mergeScm( tgt, src, sourceDominant, context );
444             if ( merged == src )
445             {
446                 builder.scm( merged );
447                 builder.location( "scm", source.getLocation( "scm" ) );
448             }
449             else if ( merged != tgt )
450             {
451                 builder.scm( merged );
452                 builder.location( "scm", InputLocation.merge( target.getLocation( "scm" ), source.getLocation( "scm" ), sourceDominant ) );
453             }
454         }
455     }
456     protected void mergeModel_IssueManagement( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
457     {
458         IssueManagement src = source.getIssueManagement();
459         if ( src != null )
460         {
461             IssueManagement tgt = target.getIssueManagement();
462             if ( tgt == null )
463             {
464                 tgt = IssueManagement.newInstance( false );
465             }
466             IssueManagement merged = mergeIssueManagement( tgt, src, sourceDominant, context );
467             if ( merged == src )
468             {
469                 builder.issueManagement( merged );
470                 builder.location( "issueManagement", source.getLocation( "issueManagement" ) );
471             }
472             else if ( merged != tgt )
473             {
474                 builder.issueManagement( merged );
475                 builder.location( "issueManagement", InputLocation.merge( target.getLocation( "issueManagement" ), source.getLocation( "issueManagement" ), sourceDominant ) );
476             }
477         }
478     }
479     protected void mergeModel_CiManagement( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
480     {
481         CiManagement src = source.getCiManagement();
482         if ( src != null )
483         {
484             CiManagement tgt = target.getCiManagement();
485             if ( tgt == null )
486             {
487                 tgt = CiManagement.newInstance( false );
488             }
489             CiManagement merged = mergeCiManagement( tgt, src, sourceDominant, context );
490             if ( merged == src )
491             {
492                 builder.ciManagement( merged );
493                 builder.location( "ciManagement", source.getLocation( "ciManagement" ) );
494             }
495             else if ( merged != tgt )
496             {
497                 builder.ciManagement( merged );
498                 builder.location( "ciManagement", InputLocation.merge( target.getLocation( "ciManagement" ), source.getLocation( "ciManagement" ), sourceDominant ) );
499             }
500         }
501     }
502     protected void mergeModel_Build( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
503     {
504         Build src = source.getBuild();
505         if ( src != null )
506         {
507             Build tgt = target.getBuild();
508             if ( tgt == null )
509             {
510                 tgt = Build.newInstance( false );
511             }
512             Build merged = mergeBuild( tgt, src, sourceDominant, context );
513             if ( merged == src )
514             {
515                 builder.build( merged );
516                 builder.location( "build", source.getLocation( "build" ) );
517             }
518             else if ( merged != tgt )
519             {
520                 builder.build( merged );
521                 builder.location( "build", InputLocation.merge( target.getLocation( "build" ), source.getLocation( "build" ), sourceDominant ) );
522             }
523         }
524     }
525     protected void mergeModel_Profiles( Model.Builder builder, Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
526     {
527         builder.profiles( merge( target.getProfiles(), source.getProfiles(), sourceDominant, getProfileKey() ) );
528     }
529 
530     protected ModelBase mergeModelBase( ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
531     {
532         ModelBase.Builder builder = ModelBase.newBuilder( target );
533         mergeModelBase( builder, target, source, sourceDominant, context );
534         return builder.build();
535     }
536 
537     protected void mergeModelBase( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
538     {
539         mergeModelBase_Modules( builder, target, source, sourceDominant, context );
540         mergeModelBase_DistributionManagement( builder, target, source, sourceDominant, context );
541         mergeModelBase_Properties( builder, target, source, sourceDominant, context );
542         mergeModelBase_DependencyManagement( builder, target, source, sourceDominant, context );
543         mergeModelBase_Dependencies( builder, target, source, sourceDominant, context );
544         mergeModelBase_Repositories( builder, target, source, sourceDominant, context );
545         mergeModelBase_PluginRepositories( builder, target, source, sourceDominant, context );
546         mergeModelBase_Reporting( builder, target, source, sourceDominant, context );
547     }
548 
549     protected void mergeModelBase_Modules( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
550     {
551         builder.modules( merge( target.getModules(), source.getModules(), sourceDominant, e -> e ) );
552     }
553     protected void mergeModelBase_DistributionManagement( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
554     {
555         DistributionManagement src = source.getDistributionManagement();
556         if ( src != null )
557         {
558             DistributionManagement tgt = target.getDistributionManagement();
559             if ( tgt == null )
560             {
561                 tgt = DistributionManagement.newInstance( false );
562             }
563             DistributionManagement merged = mergeDistributionManagement( tgt, src, sourceDominant, context );
564             if ( merged == src )
565             {
566                 builder.distributionManagement( merged );
567                 builder.location( "distributionManagement", source.getLocation( "distributionManagement" ) );
568             }
569             else if ( merged != tgt )
570             {
571                 builder.distributionManagement( merged );
572                 builder.location( "distributionManagement", InputLocation.merge( target.getLocation( "distributionManagement" ), source.getLocation( "distributionManagement" ), sourceDominant ) );
573             }
574         }
575     }
576     protected void mergeModelBase_Properties( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
577     {
578         Map<String, String> src = source.getProperties();
579         if ( !src.isEmpty() )
580         {
581             Map<String, String> tgt = target.getProperties();
582             if ( tgt.isEmpty() )
583             {
584                 builder.properties( src );
585                 builder.location( "properties", source.getLocation( "properties" ) );
586             }
587             else
588             {
589                 Map<String, String> merged = new HashMap<>();
590                 merged.putAll( sourceDominant ? target.getProperties() : source.getProperties() );
591                 merged.putAll( sourceDominant ? source.getProperties() : target.getProperties() );
592                 builder.properties( merged );
593                 builder.location( "properties", InputLocation.merge( target.getLocation( "properties" ), source.getLocation( "properties" ), sourceDominant ) );
594             }
595         }
596     }
597     protected void mergeModelBase_DependencyManagement( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
598     {
599         DependencyManagement src = source.getDependencyManagement();
600         if ( src != null )
601         {
602             DependencyManagement tgt = target.getDependencyManagement();
603             if ( tgt == null )
604             {
605                 tgt = DependencyManagement.newInstance( false );
606             }
607             DependencyManagement merged = mergeDependencyManagement( tgt, src, sourceDominant, context );
608             if ( merged == src )
609             {
610                 builder.dependencyManagement( merged );
611                 builder.location( "dependencyManagement", source.getLocation( "dependencyManagement" ) );
612             }
613             else if ( merged != tgt )
614             {
615                 builder.dependencyManagement( merged );
616                 builder.location( "dependencyManagement", InputLocation.merge( target.getLocation( "dependencyManagement" ), source.getLocation( "dependencyManagement" ), sourceDominant ) );
617             }
618         }
619     }
620     protected void mergeModelBase_Dependencies( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
621     {
622         builder.dependencies( merge( target.getDependencies(), source.getDependencies(), sourceDominant, getDependencyKey() ) );
623     }
624     protected void mergeModelBase_Repositories( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
625     {
626         builder.repositories( merge( target.getRepositories(), source.getRepositories(), sourceDominant, getRepositoryKey() ) );
627     }
628     protected void mergeModelBase_PluginRepositories( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
629     {
630         builder.pluginRepositories( merge( target.getPluginRepositories(), source.getPluginRepositories(), sourceDominant, getRepositoryKey() ) );
631     }
632     protected void mergeModelBase_Reporting( ModelBase.Builder builder, ModelBase target, ModelBase source, boolean sourceDominant, Map<Object, Object> context )
633     {
634         Reporting src = source.getReporting();
635         if ( src != null )
636         {
637             Reporting tgt = target.getReporting();
638             if ( tgt == null )
639             {
640                 tgt = Reporting.newInstance( false );
641             }
642             Reporting merged = mergeReporting( tgt, src, sourceDominant, context );
643             if ( merged == src )
644             {
645                 builder.reporting( merged );
646                 builder.location( "reporting", source.getLocation( "reporting" ) );
647             }
648             else if ( merged != tgt )
649             {
650                 builder.reporting( merged );
651                 builder.location( "reporting", InputLocation.merge( target.getLocation( "reporting" ), source.getLocation( "reporting" ), sourceDominant ) );
652             }
653         }
654     }
655 
656     protected PluginContainer mergePluginContainer( PluginContainer target, PluginContainer source, boolean sourceDominant, Map<Object, Object> context )
657     {
658         PluginContainer.Builder builder = PluginContainer.newBuilder( target );
659         mergePluginContainer( builder, target, source, sourceDominant, context );
660         return builder.build();
661     }
662 
663     protected void mergePluginContainer( PluginContainer.Builder builder, PluginContainer target, PluginContainer source, boolean sourceDominant, Map<Object, Object> context )
664     {
665         mergePluginContainer_Plugins( builder, target, source, sourceDominant, context );
666     }
667 
668     protected void mergePluginContainer_Plugins( PluginContainer.Builder builder, PluginContainer target, PluginContainer source, boolean sourceDominant, Map<Object, Object> context )
669     {
670         builder.plugins( merge( target.getPlugins(), source.getPlugins(), sourceDominant, getPluginKey() ) );
671     }
672 
673     protected PluginConfiguration mergePluginConfiguration( PluginConfiguration target, PluginConfiguration source, boolean sourceDominant, Map<Object, Object> context )
674     {
675         PluginConfiguration.Builder builder = PluginConfiguration.newBuilder( target );
676         mergePluginConfiguration( builder, target, source, sourceDominant, context );
677         return builder.build();
678     }
679 
680     protected void mergePluginConfiguration( PluginConfiguration.Builder builder, PluginConfiguration target, PluginConfiguration source, boolean sourceDominant, Map<Object, Object> context )
681     {
682         mergePluginContainer( builder, target ,source, sourceDominant, context );
683         mergePluginConfiguration_PluginManagement( builder, target, source, sourceDominant, context );
684     }
685 
686     protected void mergePluginConfiguration_Plugins( PluginConfiguration.Builder builder, PluginConfiguration target, PluginConfiguration source, boolean sourceDominant, Map<Object, Object> context )
687     {
688         builder.plugins( merge( target.getPlugins(), source.getPlugins(), sourceDominant, getPluginKey() ) );
689     }
690     protected void mergePluginConfiguration_PluginManagement( PluginConfiguration.Builder builder, PluginConfiguration target, PluginConfiguration source, boolean sourceDominant, Map<Object, Object> context )
691     {
692         PluginManagement src = source.getPluginManagement();
693         if ( src != null )
694         {
695             PluginManagement tgt = target.getPluginManagement();
696             if ( tgt == null )
697             {
698                 tgt = PluginManagement.newInstance( false );
699             }
700             PluginManagement merged = mergePluginManagement( tgt, src, sourceDominant, context );
701             if ( merged == src )
702             {
703                 builder.pluginManagement( merged );
704                 builder.location( "pluginManagement", source.getLocation( "pluginManagement" ) );
705             }
706             else if ( merged != tgt )
707             {
708                 builder.pluginManagement( merged );
709                 builder.location( "pluginManagement", InputLocation.merge( target.getLocation( "pluginManagement" ), source.getLocation( "pluginManagement" ), sourceDominant ) );
710             }
711         }
712     }
713 
714     protected BuildBase mergeBuildBase( BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
715     {
716         BuildBase.Builder builder = BuildBase.newBuilder( target );
717         mergeBuildBase( builder, target, source, sourceDominant, context );
718         return builder.build();
719     }
720 
721     protected void mergeBuildBase( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
722     {
723         mergePluginConfiguration( builder, target ,source, sourceDominant, context );
724         mergeBuildBase_DefaultGoal( builder, target, source, sourceDominant, context );
725         mergeBuildBase_Resources( builder, target, source, sourceDominant, context );
726         mergeBuildBase_TestResources( builder, target, source, sourceDominant, context );
727         mergeBuildBase_Directory( builder, target, source, sourceDominant, context );
728         mergeBuildBase_FinalName( builder, target, source, sourceDominant, context );
729         mergeBuildBase_Filters( builder, target, source, sourceDominant, context );
730     }
731 
732     protected void mergeBuildBase_Plugins( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
733     {
734         builder.plugins( merge( target.getPlugins(), source.getPlugins(), sourceDominant, getPluginKey() ) );
735     }
736     protected void mergeBuildBase_PluginManagement( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
737     {
738         PluginManagement src = source.getPluginManagement();
739         if ( src != null )
740         {
741             PluginManagement tgt = target.getPluginManagement();
742             if ( tgt == null )
743             {
744                 tgt = PluginManagement.newInstance( false );
745             }
746             PluginManagement merged = mergePluginManagement( tgt, src, sourceDominant, context );
747             if ( merged == src )
748             {
749                 builder.pluginManagement( merged );
750                 builder.location( "pluginManagement", source.getLocation( "pluginManagement" ) );
751             }
752             else if ( merged != tgt )
753             {
754                 builder.pluginManagement( merged );
755                 builder.location( "pluginManagement", InputLocation.merge( target.getLocation( "pluginManagement" ), source.getLocation( "pluginManagement" ), sourceDominant ) );
756             }
757         }
758     }
759     protected void mergeBuildBase_DefaultGoal( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
760     {
761         String src = source.getDefaultGoal();
762         String tgt = target.getDefaultGoal();
763         if ( src != null && ( sourceDominant || tgt == null ) )
764         {
765             builder.defaultGoal( src );
766             builder.location( "defaultGoal", source.getLocation( "defaultGoal" ) );
767         }
768     }
769     protected void mergeBuildBase_Resources( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
770     {
771         builder.resources( merge( target.getResources(), source.getResources(), sourceDominant, getResourceKey() ) );
772     }
773     protected void mergeBuildBase_TestResources( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
774     {
775         builder.testResources( merge( target.getTestResources(), source.getTestResources(), sourceDominant, getResourceKey() ) );
776     }
777     protected void mergeBuildBase_Directory( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
778     {
779         String src = source.getDirectory();
780         String tgt = target.getDirectory();
781         if ( src != null && ( sourceDominant || tgt == null ) )
782         {
783             builder.directory( src );
784             builder.location( "directory", source.getLocation( "directory" ) );
785         }
786     }
787     protected void mergeBuildBase_FinalName( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
788     {
789         String src = source.getFinalName();
790         String tgt = target.getFinalName();
791         if ( src != null && ( sourceDominant || tgt == null ) )
792         {
793             builder.finalName( src );
794             builder.location( "finalName", source.getLocation( "finalName" ) );
795         }
796     }
797     protected void mergeBuildBase_Filters( BuildBase.Builder builder, BuildBase target, BuildBase source, boolean sourceDominant, Map<Object, Object> context )
798     {
799         builder.filters( merge( target.getFilters(), source.getFilters(), sourceDominant, e -> e ) );
800     }
801 
802     protected Build mergeBuild( Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
803     {
804         Build.Builder builder = Build.newBuilder( target );
805         mergeBuild( builder, target, source, sourceDominant, context );
806         return builder.build();
807     }
808 
809     protected void mergeBuild( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
810     {
811         mergeBuildBase( builder, target ,source, sourceDominant, context );
812         mergeBuild_SourceDirectory( builder, target, source, sourceDominant, context );
813         mergeBuild_ScriptSourceDirectory( builder, target, source, sourceDominant, context );
814         mergeBuild_TestSourceDirectory( builder, target, source, sourceDominant, context );
815         mergeBuild_OutputDirectory( builder, target, source, sourceDominant, context );
816         mergeBuild_TestOutputDirectory( builder, target, source, sourceDominant, context );
817         mergeBuild_Extensions( builder, target, source, sourceDominant, context );
818     }
819 
820     protected void mergeBuild_Plugins( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
821     {
822         builder.plugins( merge( target.getPlugins(), source.getPlugins(), sourceDominant, getPluginKey() ) );
823     }
824     protected void mergeBuild_PluginManagement( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
825     {
826         PluginManagement src = source.getPluginManagement();
827         if ( src != null )
828         {
829             PluginManagement tgt = target.getPluginManagement();
830             if ( tgt == null )
831             {
832                 tgt = PluginManagement.newInstance( false );
833             }
834             PluginManagement merged = mergePluginManagement( tgt, src, sourceDominant, context );
835             if ( merged == src )
836             {
837                 builder.pluginManagement( merged );
838                 builder.location( "pluginManagement", source.getLocation( "pluginManagement" ) );
839             }
840             else if ( merged != tgt )
841             {
842                 builder.pluginManagement( merged );
843                 builder.location( "pluginManagement", InputLocation.merge( target.getLocation( "pluginManagement" ), source.getLocation( "pluginManagement" ), sourceDominant ) );
844             }
845         }
846     }
847     protected void mergeBuild_DefaultGoal( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
848     {
849         String src = source.getDefaultGoal();
850         String tgt = target.getDefaultGoal();
851         if ( src != null && ( sourceDominant || tgt == null ) )
852         {
853             builder.defaultGoal( src );
854             builder.location( "defaultGoal", source.getLocation( "defaultGoal" ) );
855         }
856     }
857     protected void mergeBuild_Resources( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
858     {
859         builder.resources( merge( target.getResources(), source.getResources(), sourceDominant, getResourceKey() ) );
860     }
861     protected void mergeBuild_TestResources( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
862     {
863         builder.testResources( merge( target.getTestResources(), source.getTestResources(), sourceDominant, getResourceKey() ) );
864     }
865     protected void mergeBuild_Directory( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
866     {
867         String src = source.getDirectory();
868         String tgt = target.getDirectory();
869         if ( src != null && ( sourceDominant || tgt == null ) )
870         {
871             builder.directory( src );
872             builder.location( "directory", source.getLocation( "directory" ) );
873         }
874     }
875     protected void mergeBuild_FinalName( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
876     {
877         String src = source.getFinalName();
878         String tgt = target.getFinalName();
879         if ( src != null && ( sourceDominant || tgt == null ) )
880         {
881             builder.finalName( src );
882             builder.location( "finalName", source.getLocation( "finalName" ) );
883         }
884     }
885     protected void mergeBuild_Filters( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
886     {
887         builder.filters( merge( target.getFilters(), source.getFilters(), sourceDominant, e -> e ) );
888     }
889     protected void mergeBuild_SourceDirectory( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
890     {
891         String src = source.getSourceDirectory();
892         String tgt = target.getSourceDirectory();
893         if ( src != null && ( sourceDominant || tgt == null ) )
894         {
895             builder.sourceDirectory( src );
896             builder.location( "sourceDirectory", source.getLocation( "sourceDirectory" ) );
897         }
898     }
899     protected void mergeBuild_ScriptSourceDirectory( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
900     {
901         String src = source.getScriptSourceDirectory();
902         String tgt = target.getScriptSourceDirectory();
903         if ( src != null && ( sourceDominant || tgt == null ) )
904         {
905             builder.scriptSourceDirectory( src );
906             builder.location( "scriptSourceDirectory", source.getLocation( "scriptSourceDirectory" ) );
907         }
908     }
909     protected void mergeBuild_TestSourceDirectory( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
910     {
911         String src = source.getTestSourceDirectory();
912         String tgt = target.getTestSourceDirectory();
913         if ( src != null && ( sourceDominant || tgt == null ) )
914         {
915             builder.testSourceDirectory( src );
916             builder.location( "testSourceDirectory", source.getLocation( "testSourceDirectory" ) );
917         }
918     }
919     protected void mergeBuild_OutputDirectory( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
920     {
921         String src = source.getOutputDirectory();
922         String tgt = target.getOutputDirectory();
923         if ( src != null && ( sourceDominant || tgt == null ) )
924         {
925             builder.outputDirectory( src );
926             builder.location( "outputDirectory", source.getLocation( "outputDirectory" ) );
927         }
928     }
929     protected void mergeBuild_TestOutputDirectory( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
930     {
931         String src = source.getTestOutputDirectory();
932         String tgt = target.getTestOutputDirectory();
933         if ( src != null && ( sourceDominant || tgt == null ) )
934         {
935             builder.testOutputDirectory( src );
936             builder.location( "testOutputDirectory", source.getLocation( "testOutputDirectory" ) );
937         }
938     }
939     protected void mergeBuild_Extensions( Build.Builder builder, Build target, Build source, boolean sourceDominant, Map<Object, Object> context )
940     {
941         builder.extensions( merge( target.getExtensions(), source.getExtensions(), sourceDominant, getExtensionKey() ) );
942     }
943 
944     protected CiManagement mergeCiManagement( CiManagement target, CiManagement source, boolean sourceDominant, Map<Object, Object> context )
945     {
946         CiManagement.Builder builder = CiManagement.newBuilder( target );
947         mergeCiManagement( builder, target, source, sourceDominant, context );
948         return builder.build();
949     }
950 
951     protected void mergeCiManagement( CiManagement.Builder builder, CiManagement target, CiManagement source, boolean sourceDominant, Map<Object, Object> context )
952     {
953         mergeCiManagement_System( builder, target, source, sourceDominant, context );
954         mergeCiManagement_Url( builder, target, source, sourceDominant, context );
955         mergeCiManagement_Notifiers( builder, target, source, sourceDominant, context );
956     }
957 
958     protected void mergeCiManagement_System( CiManagement.Builder builder, CiManagement target, CiManagement source, boolean sourceDominant, Map<Object, Object> context )
959     {
960         String src = source.getSystem();
961         String tgt = target.getSystem();
962         if ( src != null && ( sourceDominant || tgt == null ) )
963         {
964             builder.system( src );
965             builder.location( "system", source.getLocation( "system" ) );
966         }
967     }
968     protected void mergeCiManagement_Url( CiManagement.Builder builder, CiManagement target, CiManagement source, boolean sourceDominant, Map<Object, Object> context )
969     {
970         String src = source.getUrl();
971         String tgt = target.getUrl();
972         if ( src != null && ( sourceDominant || tgt == null ) )
973         {
974             builder.url( src );
975             builder.location( "url", source.getLocation( "url" ) );
976         }
977     }
978     protected void mergeCiManagement_Notifiers( CiManagement.Builder builder, CiManagement target, CiManagement source, boolean sourceDominant, Map<Object, Object> context )
979     {
980         builder.notifiers( merge( target.getNotifiers(), source.getNotifiers(), sourceDominant, getNotifierKey() ) );
981     }
982 
983     protected Notifier mergeNotifier( Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
984     {
985         Notifier.Builder builder = Notifier.newBuilder( target );
986         mergeNotifier( builder, target, source, sourceDominant, context );
987         return builder.build();
988     }
989 
990     protected void mergeNotifier( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
991     {
992         mergeNotifier_Type( builder, target, source, sourceDominant, context );
993         mergeNotifier_SendOnError( builder, target, source, sourceDominant, context );
994         mergeNotifier_SendOnFailure( builder, target, source, sourceDominant, context );
995         mergeNotifier_SendOnSuccess( builder, target, source, sourceDominant, context );
996         mergeNotifier_SendOnWarning( builder, target, source, sourceDominant, context );
997         mergeNotifier_Address( builder, target, source, sourceDominant, context );
998         mergeNotifier_Configuration( builder, target, source, sourceDominant, context );
999     }
1000 
1001     protected void mergeNotifier_Type( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1002     {
1003         String src = source.getType();
1004         String tgt = target.getType();
1005         if ( src != null && ( sourceDominant || tgt == null ) )
1006         {
1007             builder.type( src );
1008             builder.location( "type", source.getLocation( "type" ) );
1009         }
1010     }
1011     protected void mergeNotifier_SendOnError( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1012     {
1013         if ( sourceDominant )
1014         {
1015             builder.sendOnError( source.isSendOnError() );
1016         }
1017     }
1018     protected void mergeNotifier_SendOnFailure( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1019     {
1020         if ( sourceDominant )
1021         {
1022             builder.sendOnFailure( source.isSendOnFailure() );
1023         }
1024     }
1025     protected void mergeNotifier_SendOnSuccess( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1026     {
1027         if ( sourceDominant )
1028         {
1029             builder.sendOnSuccess( source.isSendOnSuccess() );
1030         }
1031     }
1032     protected void mergeNotifier_SendOnWarning( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1033     {
1034         if ( sourceDominant )
1035         {
1036             builder.sendOnWarning( source.isSendOnWarning() );
1037         }
1038     }
1039     protected void mergeNotifier_Address( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1040     {
1041         String src = source.getAddress();
1042         String tgt = target.getAddress();
1043         if ( src != null && ( sourceDominant || tgt == null ) )
1044         {
1045             builder.address( src );
1046             builder.location( "address", source.getLocation( "address" ) );
1047         }
1048     }
1049     protected void mergeNotifier_Configuration( Notifier.Builder builder, Notifier target, Notifier source, boolean sourceDominant, Map<Object, Object> context )
1050     {
1051         Map<String, String> src = source.getConfiguration();
1052         if ( !src.isEmpty() )
1053         {
1054             Map<String, String> tgt = target.getConfiguration();
1055             if ( tgt.isEmpty() )
1056             {
1057                 builder.configuration( src );
1058                 builder.location( "configuration", source.getLocation( "configuration" ) );
1059             }
1060             else
1061             {
1062                 Map<String, String> merged = new HashMap<>();
1063                 merged.putAll( sourceDominant ? target.getConfiguration() : source.getConfiguration() );
1064                 merged.putAll( sourceDominant ? source.getConfiguration() : target.getConfiguration() );
1065                 builder.configuration( merged );
1066                 builder.location( "configuration", InputLocation.merge( target.getLocation( "configuration" ), source.getLocation( "configuration" ), sourceDominant ) );
1067             }
1068         }
1069     }
1070 
1071     protected Contributor mergeContributor( Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1072     {
1073         Contributor.Builder builder = Contributor.newBuilder( target );
1074         mergeContributor( builder, target, source, sourceDominant, context );
1075         return builder.build();
1076     }
1077 
1078     protected void mergeContributor( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1079     {
1080         mergeContributor_Name( builder, target, source, sourceDominant, context );
1081         mergeContributor_Email( builder, target, source, sourceDominant, context );
1082         mergeContributor_Url( builder, target, source, sourceDominant, context );
1083         mergeContributor_Organization( builder, target, source, sourceDominant, context );
1084         mergeContributor_OrganizationUrl( builder, target, source, sourceDominant, context );
1085         mergeContributor_Roles( builder, target, source, sourceDominant, context );
1086         mergeContributor_Timezone( builder, target, source, sourceDominant, context );
1087         mergeContributor_Properties( builder, target, source, sourceDominant, context );
1088     }
1089 
1090     protected void mergeContributor_Name( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1091     {
1092         String src = source.getName();
1093         String tgt = target.getName();
1094         if ( src != null && ( sourceDominant || tgt == null ) )
1095         {
1096             builder.name( src );
1097             builder.location( "name", source.getLocation( "name" ) );
1098         }
1099     }
1100     protected void mergeContributor_Email( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1101     {
1102         String src = source.getEmail();
1103         String tgt = target.getEmail();
1104         if ( src != null && ( sourceDominant || tgt == null ) )
1105         {
1106             builder.email( src );
1107             builder.location( "email", source.getLocation( "email" ) );
1108         }
1109     }
1110     protected void mergeContributor_Url( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1111     {
1112         String src = source.getUrl();
1113         String tgt = target.getUrl();
1114         if ( src != null && ( sourceDominant || tgt == null ) )
1115         {
1116             builder.url( src );
1117             builder.location( "url", source.getLocation( "url" ) );
1118         }
1119     }
1120     protected void mergeContributor_Organization( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1121     {
1122         String src = source.getOrganization();
1123         String tgt = target.getOrganization();
1124         if ( src != null && ( sourceDominant || tgt == null ) )
1125         {
1126             builder.organization( src );
1127             builder.location( "organization", source.getLocation( "organization" ) );
1128         }
1129     }
1130     protected void mergeContributor_OrganizationUrl( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1131     {
1132         String src = source.getOrganizationUrl();
1133         String tgt = target.getOrganizationUrl();
1134         if ( src != null && ( sourceDominant || tgt == null ) )
1135         {
1136             builder.organizationUrl( src );
1137             builder.location( "organizationUrl", source.getLocation( "organizationUrl" ) );
1138         }
1139     }
1140     protected void mergeContributor_Roles( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1141     {
1142         builder.roles( merge( target.getRoles(), source.getRoles(), sourceDominant, e -> e ) );
1143     }
1144     protected void mergeContributor_Timezone( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1145     {
1146         String src = source.getTimezone();
1147         String tgt = target.getTimezone();
1148         if ( src != null && ( sourceDominant || tgt == null ) )
1149         {
1150             builder.timezone( src );
1151             builder.location( "timezone", source.getLocation( "timezone" ) );
1152         }
1153     }
1154     protected void mergeContributor_Properties( Contributor.Builder builder, Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context )
1155     {
1156         Map<String, String> src = source.getProperties();
1157         if ( !src.isEmpty() )
1158         {
1159             Map<String, String> tgt = target.getProperties();
1160             if ( tgt.isEmpty() )
1161             {
1162                 builder.properties( src );
1163                 builder.location( "properties", source.getLocation( "properties" ) );
1164             }
1165             else
1166             {
1167                 Map<String, String> merged = new HashMap<>();
1168                 merged.putAll( sourceDominant ? target.getProperties() : source.getProperties() );
1169                 merged.putAll( sourceDominant ? source.getProperties() : target.getProperties() );
1170                 builder.properties( merged );
1171                 builder.location( "properties", InputLocation.merge( target.getLocation( "properties" ), source.getLocation( "properties" ), sourceDominant ) );
1172             }
1173         }
1174     }
1175 
1176     protected Dependency mergeDependency( Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1177     {
1178         Dependency.Builder builder = Dependency.newBuilder( target );
1179         mergeDependency( builder, target, source, sourceDominant, context );
1180         return builder.build();
1181     }
1182 
1183     protected void mergeDependency( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1184     {
1185         mergeDependency_GroupId( builder, target, source, sourceDominant, context );
1186         mergeDependency_ArtifactId( builder, target, source, sourceDominant, context );
1187         mergeDependency_Version( builder, target, source, sourceDominant, context );
1188         mergeDependency_Type( builder, target, source, sourceDominant, context );
1189         mergeDependency_Classifier( builder, target, source, sourceDominant, context );
1190         mergeDependency_Scope( builder, target, source, sourceDominant, context );
1191         mergeDependency_SystemPath( builder, target, source, sourceDominant, context );
1192         mergeDependency_Exclusions( builder, target, source, sourceDominant, context );
1193         mergeDependency_Optional( builder, target, source, sourceDominant, context );
1194     }
1195 
1196     protected void mergeDependency_GroupId( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1197     {
1198         String src = source.getGroupId();
1199         String tgt = target.getGroupId();
1200         if ( src != null && ( sourceDominant || tgt == null ) )
1201         {
1202             builder.groupId( src );
1203             builder.location( "groupId", source.getLocation( "groupId" ) );
1204         }
1205     }
1206     protected void mergeDependency_ArtifactId( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1207     {
1208         String src = source.getArtifactId();
1209         String tgt = target.getArtifactId();
1210         if ( src != null && ( sourceDominant || tgt == null ) )
1211         {
1212             builder.artifactId( src );
1213             builder.location( "artifactId", source.getLocation( "artifactId" ) );
1214         }
1215     }
1216     protected void mergeDependency_Version( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1217     {
1218         String src = source.getVersion();
1219         String tgt = target.getVersion();
1220         if ( src != null && ( sourceDominant || tgt == null ) )
1221         {
1222             builder.version( src );
1223             builder.location( "version", source.getLocation( "version" ) );
1224         }
1225     }
1226     protected void mergeDependency_Type( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1227     {
1228         String src = source.getType();
1229         String tgt = target.getType();
1230         if ( src != null && ( sourceDominant || tgt == null ) )
1231         {
1232             builder.type( src );
1233             builder.location( "type", source.getLocation( "type" ) );
1234         }
1235     }
1236     protected void mergeDependency_Classifier( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1237     {
1238         String src = source.getClassifier();
1239         String tgt = target.getClassifier();
1240         if ( src != null && ( sourceDominant || tgt == null ) )
1241         {
1242             builder.classifier( src );
1243             builder.location( "classifier", source.getLocation( "classifier" ) );
1244         }
1245     }
1246     protected void mergeDependency_Scope( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1247     {
1248         String src = source.getScope();
1249         String tgt = target.getScope();
1250         if ( src != null && ( sourceDominant || tgt == null ) )
1251         {
1252             builder.scope( src );
1253             builder.location( "scope", source.getLocation( "scope" ) );
1254         }
1255     }
1256     protected void mergeDependency_SystemPath( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1257     {
1258         String src = source.getSystemPath();
1259         String tgt = target.getSystemPath();
1260         if ( src != null && ( sourceDominant || tgt == null ) )
1261         {
1262             builder.systemPath( src );
1263             builder.location( "systemPath", source.getLocation( "systemPath" ) );
1264         }
1265     }
1266     protected void mergeDependency_Exclusions( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1267     {
1268         builder.exclusions( merge( target.getExclusions(), source.getExclusions(), sourceDominant, getExclusionKey() ) );
1269     }
1270     protected void mergeDependency_Optional( Dependency.Builder builder, Dependency target, Dependency source, boolean sourceDominant, Map<Object, Object> context )
1271     {
1272         String src = source.getOptional();
1273         String tgt = target.getOptional();
1274         if ( src != null && ( sourceDominant || tgt == null ) )
1275         {
1276             builder.optional( src );
1277             builder.location( "optional", source.getLocation( "optional" ) );
1278         }
1279     }
1280 
1281     protected Developer mergeDeveloper( Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1282     {
1283         Developer.Builder builder = Developer.newBuilder( target );
1284         mergeDeveloper( builder, target, source, sourceDominant, context );
1285         return builder.build();
1286     }
1287 
1288     protected void mergeDeveloper( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1289     {
1290         mergeContributor( builder, target ,source, sourceDominant, context );
1291         mergeDeveloper_Id( builder, target, source, sourceDominant, context );
1292     }
1293 
1294     protected void mergeDeveloper_Name( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1295     {
1296         String src = source.getName();
1297         String tgt = target.getName();
1298         if ( src != null && ( sourceDominant || tgt == null ) )
1299         {
1300             builder.name( src );
1301             builder.location( "name", source.getLocation( "name" ) );
1302         }
1303     }
1304     protected void mergeDeveloper_Email( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1305     {
1306         String src = source.getEmail();
1307         String tgt = target.getEmail();
1308         if ( src != null && ( sourceDominant || tgt == null ) )
1309         {
1310             builder.email( src );
1311             builder.location( "email", source.getLocation( "email" ) );
1312         }
1313     }
1314     protected void mergeDeveloper_Url( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1315     {
1316         String src = source.getUrl();
1317         String tgt = target.getUrl();
1318         if ( src != null && ( sourceDominant || tgt == null ) )
1319         {
1320             builder.url( src );
1321             builder.location( "url", source.getLocation( "url" ) );
1322         }
1323     }
1324     protected void mergeDeveloper_Organization( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1325     {
1326         String src = source.getOrganization();
1327         String tgt = target.getOrganization();
1328         if ( src != null && ( sourceDominant || tgt == null ) )
1329         {
1330             builder.organization( src );
1331             builder.location( "organization", source.getLocation( "organization" ) );
1332         }
1333     }
1334     protected void mergeDeveloper_OrganizationUrl( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1335     {
1336         String src = source.getOrganizationUrl();
1337         String tgt = target.getOrganizationUrl();
1338         if ( src != null && ( sourceDominant || tgt == null ) )
1339         {
1340             builder.organizationUrl( src );
1341             builder.location( "organizationUrl", source.getLocation( "organizationUrl" ) );
1342         }
1343     }
1344     protected void mergeDeveloper_Roles( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1345     {
1346         builder.roles( merge( target.getRoles(), source.getRoles(), sourceDominant, e -> e ) );
1347     }
1348     protected void mergeDeveloper_Timezone( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1349     {
1350         String src = source.getTimezone();
1351         String tgt = target.getTimezone();
1352         if ( src != null && ( sourceDominant || tgt == null ) )
1353         {
1354             builder.timezone( src );
1355             builder.location( "timezone", source.getLocation( "timezone" ) );
1356         }
1357     }
1358     protected void mergeDeveloper_Properties( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1359     {
1360         Map<String, String> src = source.getProperties();
1361         if ( !src.isEmpty() )
1362         {
1363             Map<String, String> tgt = target.getProperties();
1364             if ( tgt.isEmpty() )
1365             {
1366                 builder.properties( src );
1367                 builder.location( "properties", source.getLocation( "properties" ) );
1368             }
1369             else
1370             {
1371                 Map<String, String> merged = new HashMap<>();
1372                 merged.putAll( sourceDominant ? target.getProperties() : source.getProperties() );
1373                 merged.putAll( sourceDominant ? source.getProperties() : target.getProperties() );
1374                 builder.properties( merged );
1375                 builder.location( "properties", InputLocation.merge( target.getLocation( "properties" ), source.getLocation( "properties" ), sourceDominant ) );
1376             }
1377         }
1378     }
1379     protected void mergeDeveloper_Id( Developer.Builder builder, Developer target, Developer source, boolean sourceDominant, Map<Object, Object> context )
1380     {
1381         String src = source.getId();
1382         String tgt = target.getId();
1383         if ( src != null && ( sourceDominant || tgt == null ) )
1384         {
1385             builder.id( src );
1386             builder.location( "id", source.getLocation( "id" ) );
1387         }
1388     }
1389 
1390     protected Exclusion mergeExclusion( Exclusion target, Exclusion source, boolean sourceDominant, Map<Object, Object> context )
1391     {
1392         Exclusion.Builder builder = Exclusion.newBuilder( target );
1393         mergeExclusion( builder, target, source, sourceDominant, context );
1394         return builder.build();
1395     }
1396 
1397     protected void mergeExclusion( Exclusion.Builder builder, Exclusion target, Exclusion source, boolean sourceDominant, Map<Object, Object> context )
1398     {
1399         mergeExclusion_GroupId( builder, target, source, sourceDominant, context );
1400         mergeExclusion_ArtifactId( builder, target, source, sourceDominant, context );
1401     }
1402 
1403     protected void mergeExclusion_GroupId( Exclusion.Builder builder, Exclusion target, Exclusion source, boolean sourceDominant, Map<Object, Object> context )
1404     {
1405         String src = source.getGroupId();
1406         String tgt = target.getGroupId();
1407         if ( src != null && ( sourceDominant || tgt == null ) )
1408         {
1409             builder.groupId( src );
1410             builder.location( "groupId", source.getLocation( "groupId" ) );
1411         }
1412     }
1413     protected void mergeExclusion_ArtifactId( Exclusion.Builder builder, Exclusion target, Exclusion source, boolean sourceDominant, Map<Object, Object> context )
1414     {
1415         String src = source.getArtifactId();
1416         String tgt = target.getArtifactId();
1417         if ( src != null && ( sourceDominant || tgt == null ) )
1418         {
1419             builder.artifactId( src );
1420             builder.location( "artifactId", source.getLocation( "artifactId" ) );
1421         }
1422     }
1423 
1424     protected IssueManagement mergeIssueManagement( IssueManagement target, IssueManagement source, boolean sourceDominant, Map<Object, Object> context )
1425     {
1426         IssueManagement.Builder builder = IssueManagement.newBuilder( target );
1427         mergeIssueManagement( builder, target, source, sourceDominant, context );
1428         return builder.build();
1429     }
1430 
1431     protected void mergeIssueManagement( IssueManagement.Builder builder, IssueManagement target, IssueManagement source, boolean sourceDominant, Map<Object, Object> context )
1432     {
1433         mergeIssueManagement_System( builder, target, source, sourceDominant, context );
1434         mergeIssueManagement_Url( builder, target, source, sourceDominant, context );
1435     }
1436 
1437     protected void mergeIssueManagement_System( IssueManagement.Builder builder, IssueManagement target, IssueManagement source, boolean sourceDominant, Map<Object, Object> context )
1438     {
1439         String src = source.getSystem();
1440         String tgt = target.getSystem();
1441         if ( src != null && ( sourceDominant || tgt == null ) )
1442         {
1443             builder.system( src );
1444             builder.location( "system", source.getLocation( "system" ) );
1445         }
1446     }
1447     protected void mergeIssueManagement_Url( IssueManagement.Builder builder, IssueManagement target, IssueManagement source, boolean sourceDominant, Map<Object, Object> context )
1448     {
1449         String src = source.getUrl();
1450         String tgt = target.getUrl();
1451         if ( src != null && ( sourceDominant || tgt == null ) )
1452         {
1453             builder.url( src );
1454             builder.location( "url", source.getLocation( "url" ) );
1455         }
1456     }
1457 
1458     protected DistributionManagement mergeDistributionManagement( DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1459     {
1460         DistributionManagement.Builder builder = DistributionManagement.newBuilder( target );
1461         mergeDistributionManagement( builder, target, source, sourceDominant, context );
1462         return builder.build();
1463     }
1464 
1465     protected void mergeDistributionManagement( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1466     {
1467         mergeDistributionManagement_Repository( builder, target, source, sourceDominant, context );
1468         mergeDistributionManagement_SnapshotRepository( builder, target, source, sourceDominant, context );
1469         mergeDistributionManagement_Site( builder, target, source, sourceDominant, context );
1470         mergeDistributionManagement_DownloadUrl( builder, target, source, sourceDominant, context );
1471         mergeDistributionManagement_Relocation( builder, target, source, sourceDominant, context );
1472         mergeDistributionManagement_Status( builder, target, source, sourceDominant, context );
1473     }
1474 
1475     protected void mergeDistributionManagement_Repository( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1476     {
1477         DeploymentRepository src = source.getRepository();
1478         if ( src != null )
1479         {
1480             DeploymentRepository tgt = target.getRepository();
1481             if ( tgt == null )
1482             {
1483                 tgt = DeploymentRepository.newInstance( false );
1484             }
1485             DeploymentRepository merged = mergeDeploymentRepository( tgt, src, sourceDominant, context );
1486             if ( merged == src )
1487             {
1488                 builder.repository( merged );
1489                 builder.location( "repository", source.getLocation( "repository" ) );
1490             }
1491             else if ( merged != tgt )
1492             {
1493                 builder.repository( merged );
1494                 builder.location( "repository", InputLocation.merge( target.getLocation( "repository" ), source.getLocation( "repository" ), sourceDominant ) );
1495             }
1496         }
1497     }
1498     protected void mergeDistributionManagement_SnapshotRepository( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1499     {
1500         DeploymentRepository src = source.getSnapshotRepository();
1501         if ( src != null )
1502         {
1503             DeploymentRepository tgt = target.getSnapshotRepository();
1504             if ( tgt == null )
1505             {
1506                 tgt = DeploymentRepository.newInstance( false );
1507             }
1508             DeploymentRepository merged = mergeDeploymentRepository( tgt, src, sourceDominant, context );
1509             if ( merged == src )
1510             {
1511                 builder.snapshotRepository( merged );
1512                 builder.location( "snapshotRepository", source.getLocation( "snapshotRepository" ) );
1513             }
1514             else if ( merged != tgt )
1515             {
1516                 builder.snapshotRepository( merged );
1517                 builder.location( "snapshotRepository", InputLocation.merge( target.getLocation( "snapshotRepository" ), source.getLocation( "snapshotRepository" ), sourceDominant ) );
1518             }
1519         }
1520     }
1521     protected void mergeDistributionManagement_Site( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1522     {
1523         Site src = source.getSite();
1524         if ( src != null )
1525         {
1526             Site tgt = target.getSite();
1527             if ( tgt == null )
1528             {
1529                 tgt = Site.newInstance( false );
1530             }
1531             Site merged = mergeSite( tgt, src, sourceDominant, context );
1532             if ( merged == src )
1533             {
1534                 builder.site( merged );
1535                 builder.location( "site", source.getLocation( "site" ) );
1536             }
1537             else if ( merged != tgt )
1538             {
1539                 builder.site( merged );
1540                 builder.location( "site", InputLocation.merge( target.getLocation( "site" ), source.getLocation( "site" ), sourceDominant ) );
1541             }
1542         }
1543     }
1544     protected void mergeDistributionManagement_DownloadUrl( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1545     {
1546         String src = source.getDownloadUrl();
1547         String tgt = target.getDownloadUrl();
1548         if ( src != null && ( sourceDominant || tgt == null ) )
1549         {
1550             builder.downloadUrl( src );
1551             builder.location( "downloadUrl", source.getLocation( "downloadUrl" ) );
1552         }
1553     }
1554     protected void mergeDistributionManagement_Relocation( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1555     {
1556         Relocation src = source.getRelocation();
1557         if ( src != null )
1558         {
1559             Relocation tgt = target.getRelocation();
1560             if ( tgt == null )
1561             {
1562                 tgt = Relocation.newInstance( false );
1563             }
1564             Relocation merged = mergeRelocation( tgt, src, sourceDominant, context );
1565             if ( merged == src )
1566             {
1567                 builder.relocation( merged );
1568                 builder.location( "relocation", source.getLocation( "relocation" ) );
1569             }
1570             else if ( merged != tgt )
1571             {
1572                 builder.relocation( merged );
1573                 builder.location( "relocation", InputLocation.merge( target.getLocation( "relocation" ), source.getLocation( "relocation" ), sourceDominant ) );
1574             }
1575         }
1576     }
1577     protected void mergeDistributionManagement_Status( DistributionManagement.Builder builder, DistributionManagement target, DistributionManagement source, boolean sourceDominant, Map<Object, Object> context )
1578     {
1579         String src = source.getStatus();
1580         String tgt = target.getStatus();
1581         if ( src != null && ( sourceDominant || tgt == null ) )
1582         {
1583             builder.status( src );
1584             builder.location( "status", source.getLocation( "status" ) );
1585         }
1586     }
1587 
1588     protected License mergeLicense( License target, License source, boolean sourceDominant, Map<Object, Object> context )
1589     {
1590         License.Builder builder = License.newBuilder( target );
1591         mergeLicense( builder, target, source, sourceDominant, context );
1592         return builder.build();
1593     }
1594 
1595     protected void mergeLicense( License.Builder builder, License target, License source, boolean sourceDominant, Map<Object, Object> context )
1596     {
1597         mergeLicense_Name( builder, target, source, sourceDominant, context );
1598         mergeLicense_Url( builder, target, source, sourceDominant, context );
1599         mergeLicense_Distribution( builder, target, source, sourceDominant, context );
1600         mergeLicense_Comments( builder, target, source, sourceDominant, context );
1601     }
1602 
1603     protected void mergeLicense_Name( License.Builder builder, License target, License source, boolean sourceDominant, Map<Object, Object> context )
1604     {
1605         String src = source.getName();
1606         String tgt = target.getName();
1607         if ( src != null && ( sourceDominant || tgt == null ) )
1608         {
1609             builder.name( src );
1610             builder.location( "name", source.getLocation( "name" ) );
1611         }
1612     }
1613     protected void mergeLicense_Url( License.Builder builder, License target, License source, boolean sourceDominant, Map<Object, Object> context )
1614     {
1615         String src = source.getUrl();
1616         String tgt = target.getUrl();
1617         if ( src != null && ( sourceDominant || tgt == null ) )
1618         {
1619             builder.url( src );
1620             builder.location( "url", source.getLocation( "url" ) );
1621         }
1622     }
1623     protected void mergeLicense_Distribution( License.Builder builder, License target, License source, boolean sourceDominant, Map<Object, Object> context )
1624     {
1625         String src = source.getDistribution();
1626         String tgt = target.getDistribution();
1627         if ( src != null && ( sourceDominant || tgt == null ) )
1628         {
1629             builder.distribution( src );
1630             builder.location( "distribution", source.getLocation( "distribution" ) );
1631         }
1632     }
1633     protected void mergeLicense_Comments( License.Builder builder, License target, License source, boolean sourceDominant, Map<Object, Object> context )
1634     {
1635         String src = source.getComments();
1636         String tgt = target.getComments();
1637         if ( src != null && ( sourceDominant || tgt == null ) )
1638         {
1639             builder.comments( src );
1640             builder.location( "comments", source.getLocation( "comments" ) );
1641         }
1642     }
1643 
1644     protected MailingList mergeMailingList( MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1645     {
1646         MailingList.Builder builder = MailingList.newBuilder( target );
1647         mergeMailingList( builder, target, source, sourceDominant, context );
1648         return builder.build();
1649     }
1650 
1651     protected void mergeMailingList( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1652     {
1653         mergeMailingList_Name( builder, target, source, sourceDominant, context );
1654         mergeMailingList_Subscribe( builder, target, source, sourceDominant, context );
1655         mergeMailingList_Unsubscribe( builder, target, source, sourceDominant, context );
1656         mergeMailingList_Post( builder, target, source, sourceDominant, context );
1657         mergeMailingList_Archive( builder, target, source, sourceDominant, context );
1658         mergeMailingList_OtherArchives( builder, target, source, sourceDominant, context );
1659     }
1660 
1661     protected void mergeMailingList_Name( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1662     {
1663         String src = source.getName();
1664         String tgt = target.getName();
1665         if ( src != null && ( sourceDominant || tgt == null ) )
1666         {
1667             builder.name( src );
1668             builder.location( "name", source.getLocation( "name" ) );
1669         }
1670     }
1671     protected void mergeMailingList_Subscribe( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1672     {
1673         String src = source.getSubscribe();
1674         String tgt = target.getSubscribe();
1675         if ( src != null && ( sourceDominant || tgt == null ) )
1676         {
1677             builder.subscribe( src );
1678             builder.location( "subscribe", source.getLocation( "subscribe" ) );
1679         }
1680     }
1681     protected void mergeMailingList_Unsubscribe( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1682     {
1683         String src = source.getUnsubscribe();
1684         String tgt = target.getUnsubscribe();
1685         if ( src != null && ( sourceDominant || tgt == null ) )
1686         {
1687             builder.unsubscribe( src );
1688             builder.location( "unsubscribe", source.getLocation( "unsubscribe" ) );
1689         }
1690     }
1691     protected void mergeMailingList_Post( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1692     {
1693         String src = source.getPost();
1694         String tgt = target.getPost();
1695         if ( src != null && ( sourceDominant || tgt == null ) )
1696         {
1697             builder.post( src );
1698             builder.location( "post", source.getLocation( "post" ) );
1699         }
1700     }
1701     protected void mergeMailingList_Archive( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1702     {
1703         String src = source.getArchive();
1704         String tgt = target.getArchive();
1705         if ( src != null && ( sourceDominant || tgt == null ) )
1706         {
1707             builder.archive( src );
1708             builder.location( "archive", source.getLocation( "archive" ) );
1709         }
1710     }
1711     protected void mergeMailingList_OtherArchives( MailingList.Builder builder, MailingList target, MailingList source, boolean sourceDominant, Map<Object, Object> context )
1712     {
1713         builder.otherArchives( merge( target.getOtherArchives(), source.getOtherArchives(), sourceDominant, e -> e ) );
1714     }
1715 
1716     protected Organization mergeOrganization( Organization target, Organization source, boolean sourceDominant, Map<Object, Object> context )
1717     {
1718         Organization.Builder builder = Organization.newBuilder( target );
1719         mergeOrganization( builder, target, source, sourceDominant, context );
1720         return builder.build();
1721     }
1722 
1723     protected void mergeOrganization( Organization.Builder builder, Organization target, Organization source, boolean sourceDominant, Map<Object, Object> context )
1724     {
1725         mergeOrganization_Name( builder, target, source, sourceDominant, context );
1726         mergeOrganization_Url( builder, target, source, sourceDominant, context );
1727     }
1728 
1729     protected void mergeOrganization_Name( Organization.Builder builder, Organization target, Organization source, boolean sourceDominant, Map<Object, Object> context )
1730     {
1731         String src = source.getName();
1732         String tgt = target.getName();
1733         if ( src != null && ( sourceDominant || tgt == null ) )
1734         {
1735             builder.name( src );
1736             builder.location( "name", source.getLocation( "name" ) );
1737         }
1738     }
1739     protected void mergeOrganization_Url( Organization.Builder builder, Organization target, Organization source, boolean sourceDominant, Map<Object, Object> context )
1740     {
1741         String src = source.getUrl();
1742         String tgt = target.getUrl();
1743         if ( src != null && ( sourceDominant || tgt == null ) )
1744         {
1745             builder.url( src );
1746             builder.location( "url", source.getLocation( "url" ) );
1747         }
1748     }
1749 
1750     protected PatternSet mergePatternSet( PatternSet target, PatternSet source, boolean sourceDominant, Map<Object, Object> context )
1751     {
1752         PatternSet.Builder builder = PatternSet.newBuilder( target );
1753         mergePatternSet( builder, target, source, sourceDominant, context );
1754         return builder.build();
1755     }
1756 
1757     protected void mergePatternSet( PatternSet.Builder builder, PatternSet target, PatternSet source, boolean sourceDominant, Map<Object, Object> context )
1758     {
1759         mergePatternSet_Includes( builder, target, source, sourceDominant, context );
1760         mergePatternSet_Excludes( builder, target, source, sourceDominant, context );
1761     }
1762 
1763     protected void mergePatternSet_Includes( PatternSet.Builder builder, PatternSet target, PatternSet source, boolean sourceDominant, Map<Object, Object> context )
1764     {
1765         builder.includes( merge( target.getIncludes(), source.getIncludes(), sourceDominant, e -> e ) );
1766     }
1767     protected void mergePatternSet_Excludes( PatternSet.Builder builder, PatternSet target, PatternSet source, boolean sourceDominant, Map<Object, Object> context )
1768     {
1769         builder.excludes( merge( target.getExcludes(), source.getExcludes(), sourceDominant, e -> e ) );
1770     }
1771 
1772     protected Parent mergeParent( Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1773     {
1774         Parent.Builder builder = Parent.newBuilder( target );
1775         mergeParent( builder, target, source, sourceDominant, context );
1776         return builder.build();
1777     }
1778 
1779     protected void mergeParent( Parent.Builder builder, Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1780     {
1781         mergeParent_GroupId( builder, target, source, sourceDominant, context );
1782         mergeParent_ArtifactId( builder, target, source, sourceDominant, context );
1783         mergeParent_Version( builder, target, source, sourceDominant, context );
1784         mergeParent_RelativePath( builder, target, source, sourceDominant, context );
1785     }
1786 
1787     protected void mergeParent_GroupId( Parent.Builder builder, Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1788     {
1789         String src = source.getGroupId();
1790         String tgt = target.getGroupId();
1791         if ( src != null && ( sourceDominant || tgt == null ) )
1792         {
1793             builder.groupId( src );
1794             builder.location( "groupId", source.getLocation( "groupId" ) );
1795         }
1796     }
1797     protected void mergeParent_ArtifactId( Parent.Builder builder, Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1798     {
1799         String src = source.getArtifactId();
1800         String tgt = target.getArtifactId();
1801         if ( src != null && ( sourceDominant || tgt == null ) )
1802         {
1803             builder.artifactId( src );
1804             builder.location( "artifactId", source.getLocation( "artifactId" ) );
1805         }
1806     }
1807     protected void mergeParent_Version( Parent.Builder builder, Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1808     {
1809         String src = source.getVersion();
1810         String tgt = target.getVersion();
1811         if ( src != null && ( sourceDominant || tgt == null ) )
1812         {
1813             builder.version( src );
1814             builder.location( "version", source.getLocation( "version" ) );
1815         }
1816     }
1817     protected void mergeParent_RelativePath( Parent.Builder builder, Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context )
1818     {
1819         String src = source.getRelativePath();
1820         String tgt = target.getRelativePath();
1821         if ( src != null && ( sourceDominant || tgt == null ) )
1822         {
1823             builder.relativePath( src );
1824             builder.location( "relativePath", source.getLocation( "relativePath" ) );
1825         }
1826     }
1827 
1828     protected Scm mergeScm( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1829     {
1830         Scm.Builder builder = Scm.newBuilder( target );
1831         mergeScm( builder, target, source, sourceDominant, context );
1832         return builder.build();
1833     }
1834 
1835     protected void mergeScm( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1836     {
1837         mergeScm_Connection( builder, target, source, sourceDominant, context );
1838         mergeScm_DeveloperConnection( builder, target, source, sourceDominant, context );
1839         mergeScm_Tag( builder, target, source, sourceDominant, context );
1840         mergeScm_Url( builder, target, source, sourceDominant, context );
1841         mergeScm_ChildScmConnectionInheritAppendPath( builder, target, source, sourceDominant, context );
1842         mergeScm_ChildScmDeveloperConnectionInheritAppendPath( builder, target, source, sourceDominant, context );
1843         mergeScm_ChildScmUrlInheritAppendPath( builder, target, source, sourceDominant, context );
1844     }
1845 
1846     protected void mergeScm_Connection( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1847     {
1848         String src = source.getConnection();
1849         String tgt = target.getConnection();
1850         if ( src != null && ( sourceDominant || tgt == null ) )
1851         {
1852             builder.connection( src );
1853             builder.location( "connection", source.getLocation( "connection" ) );
1854         }
1855     }
1856     protected void mergeScm_DeveloperConnection( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1857     {
1858         String src = source.getDeveloperConnection();
1859         String tgt = target.getDeveloperConnection();
1860         if ( src != null && ( sourceDominant || tgt == null ) )
1861         {
1862             builder.developerConnection( src );
1863             builder.location( "developerConnection", source.getLocation( "developerConnection" ) );
1864         }
1865     }
1866     protected void mergeScm_Tag( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1867     {
1868         String src = source.getTag();
1869         String tgt = target.getTag();
1870         if ( src != null && ( sourceDominant || tgt == null ) )
1871         {
1872             builder.tag( src );
1873             builder.location( "tag", source.getLocation( "tag" ) );
1874         }
1875     }
1876     protected void mergeScm_Url( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1877     {
1878         String src = source.getUrl();
1879         String tgt = target.getUrl();
1880         if ( src != null && ( sourceDominant || tgt == null ) )
1881         {
1882             builder.url( src );
1883             builder.location( "url", source.getLocation( "url" ) );
1884         }
1885     }
1886     protected void mergeScm_ChildScmConnectionInheritAppendPath( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1887     {
1888         String src = source.getChildScmConnectionInheritAppendPath();
1889         String tgt = target.getChildScmConnectionInheritAppendPath();
1890         if ( src != null && ( sourceDominant || tgt == null ) )
1891         {
1892             builder.childScmConnectionInheritAppendPath( src );
1893             builder.location( "childScmConnectionInheritAppendPath", source.getLocation( "childScmConnectionInheritAppendPath" ) );
1894         }
1895     }
1896     protected void mergeScm_ChildScmDeveloperConnectionInheritAppendPath( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1897     {
1898         String src = source.getChildScmDeveloperConnectionInheritAppendPath();
1899         String tgt = target.getChildScmDeveloperConnectionInheritAppendPath();
1900         if ( src != null && ( sourceDominant || tgt == null ) )
1901         {
1902             builder.childScmDeveloperConnectionInheritAppendPath( src );
1903             builder.location( "childScmDeveloperConnectionInheritAppendPath", source.getLocation( "childScmDeveloperConnectionInheritAppendPath" ) );
1904         }
1905     }
1906     protected void mergeScm_ChildScmUrlInheritAppendPath( Scm.Builder builder, Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
1907     {
1908         String src = source.getChildScmUrlInheritAppendPath();
1909         String tgt = target.getChildScmUrlInheritAppendPath();
1910         if ( src != null && ( sourceDominant || tgt == null ) )
1911         {
1912             builder.childScmUrlInheritAppendPath( src );
1913             builder.location( "childScmUrlInheritAppendPath", source.getLocation( "childScmUrlInheritAppendPath" ) );
1914         }
1915     }
1916 
1917     protected FileSet mergeFileSet( FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
1918     {
1919         FileSet.Builder builder = FileSet.newBuilder( target );
1920         mergeFileSet( builder, target, source, sourceDominant, context );
1921         return builder.build();
1922     }
1923 
1924     protected void mergeFileSet( FileSet.Builder builder, FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
1925     {
1926         mergePatternSet( builder, target ,source, sourceDominant, context );
1927         mergeFileSet_Directory( builder, target, source, sourceDominant, context );
1928     }
1929 
1930     protected void mergeFileSet_Includes( FileSet.Builder builder, FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
1931     {
1932         builder.includes( merge( target.getIncludes(), source.getIncludes(), sourceDominant, e -> e ) );
1933     }
1934     protected void mergeFileSet_Excludes( FileSet.Builder builder, FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
1935     {
1936         builder.excludes( merge( target.getExcludes(), source.getExcludes(), sourceDominant, e -> e ) );
1937     }
1938     protected void mergeFileSet_Directory( FileSet.Builder builder, FileSet target, FileSet source, boolean sourceDominant, Map<Object, Object> context )
1939     {
1940         String src = source.getDirectory();
1941         String tgt = target.getDirectory();
1942         if ( src != null && ( sourceDominant || tgt == null ) )
1943         {
1944             builder.directory( src );
1945             builder.location( "directory", source.getLocation( "directory" ) );
1946         }
1947     }
1948 
1949     protected Resource mergeResource( Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1950     {
1951         Resource.Builder builder = Resource.newBuilder( target );
1952         mergeResource( builder, target, source, sourceDominant, context );
1953         return builder.build();
1954     }
1955 
1956     protected void mergeResource( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1957     {
1958         mergeFileSet( builder, target ,source, sourceDominant, context );
1959         mergeResource_TargetPath( builder, target, source, sourceDominant, context );
1960         mergeResource_Filtering( builder, target, source, sourceDominant, context );
1961         mergeResource_MergeId( builder, target, source, sourceDominant, context );
1962     }
1963 
1964     protected void mergeResource_Includes( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1965     {
1966         builder.includes( merge( target.getIncludes(), source.getIncludes(), sourceDominant, e -> e ) );
1967     }
1968     protected void mergeResource_Excludes( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1969     {
1970         builder.excludes( merge( target.getExcludes(), source.getExcludes(), sourceDominant, e -> e ) );
1971     }
1972     protected void mergeResource_Directory( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1973     {
1974         String src = source.getDirectory();
1975         String tgt = target.getDirectory();
1976         if ( src != null && ( sourceDominant || tgt == null ) )
1977         {
1978             builder.directory( src );
1979             builder.location( "directory", source.getLocation( "directory" ) );
1980         }
1981     }
1982     protected void mergeResource_TargetPath( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1983     {
1984         String src = source.getTargetPath();
1985         String tgt = target.getTargetPath();
1986         if ( src != null && ( sourceDominant || tgt == null ) )
1987         {
1988             builder.targetPath( src );
1989             builder.location( "targetPath", source.getLocation( "targetPath" ) );
1990         }
1991     }
1992     protected void mergeResource_Filtering( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
1993     {
1994         String src = source.getFiltering();
1995         String tgt = target.getFiltering();
1996         if ( src != null && ( sourceDominant || tgt == null ) )
1997         {
1998             builder.filtering( src );
1999             builder.location( "filtering", source.getLocation( "filtering" ) );
2000         }
2001     }
2002     protected void mergeResource_MergeId( Resource.Builder builder, Resource target, Resource source, boolean sourceDominant, Map<Object, Object> context )
2003     {
2004         String src = source.getMergeId();
2005         String tgt = target.getMergeId();
2006         if ( src != null && ( sourceDominant || tgt == null ) )
2007         {
2008             builder.mergeId( src );
2009             builder.location( "mergeId", source.getLocation( "mergeId" ) );
2010         }
2011     }
2012 
2013     protected RepositoryBase mergeRepositoryBase( RepositoryBase target, RepositoryBase source, boolean sourceDominant, Map<Object, Object> context )
2014     {
2015         RepositoryBase.Builder builder = RepositoryBase.newBuilder( target );
2016         mergeRepositoryBase( builder, target, source, sourceDominant, context );
2017         return builder.build();
2018     }
2019 
2020     protected void mergeRepositoryBase( RepositoryBase.Builder builder, RepositoryBase target, RepositoryBase source, boolean sourceDominant, Map<Object, Object> context )
2021     {
2022         mergeRepositoryBase_Id( builder, target, source, sourceDominant, context );
2023         mergeRepositoryBase_Name( builder, target, source, sourceDominant, context );
2024         mergeRepositoryBase_Url( builder, target, source, sourceDominant, context );
2025         mergeRepositoryBase_Layout( builder, target, source, sourceDominant, context );
2026     }
2027 
2028     protected void mergeRepositoryBase_Id( RepositoryBase.Builder builder, RepositoryBase target, RepositoryBase source, boolean sourceDominant, Map<Object, Object> context )
2029     {
2030         String src = source.getId();
2031         String tgt = target.getId();
2032         if ( src != null && ( sourceDominant || tgt == null ) )
2033         {
2034             builder.id( src );
2035             builder.location( "id", source.getLocation( "id" ) );
2036         }
2037     }
2038     protected void mergeRepositoryBase_Name( RepositoryBase.Builder builder, RepositoryBase target, RepositoryBase source, boolean sourceDominant, Map<Object, Object> context )
2039     {
2040         String src = source.getName();
2041         String tgt = target.getName();
2042         if ( src != null && ( sourceDominant || tgt == null ) )
2043         {
2044             builder.name( src );
2045             builder.location( "name", source.getLocation( "name" ) );
2046         }
2047     }
2048     protected void mergeRepositoryBase_Url( RepositoryBase.Builder builder, RepositoryBase target, RepositoryBase source, boolean sourceDominant, Map<Object, Object> context )
2049     {
2050         String src = source.getUrl();
2051         String tgt = target.getUrl();
2052         if ( src != null && ( sourceDominant || tgt == null ) )
2053         {
2054             builder.url( src );
2055             builder.location( "url", source.getLocation( "url" ) );
2056         }
2057     }
2058     protected void mergeRepositoryBase_Layout( RepositoryBase.Builder builder, RepositoryBase target, RepositoryBase source, boolean sourceDominant, Map<Object, Object> context )
2059     {
2060         String src = source.getLayout();
2061         String tgt = target.getLayout();
2062         if ( src != null && ( sourceDominant || tgt == null ) )
2063         {
2064             builder.layout( src );
2065             builder.location( "layout", source.getLocation( "layout" ) );
2066         }
2067     }
2068 
2069     protected Repository mergeRepository( Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2070     {
2071         Repository.Builder builder = Repository.newBuilder( target );
2072         mergeRepository( builder, target, source, sourceDominant, context );
2073         return builder.build();
2074     }
2075 
2076     protected void mergeRepository( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2077     {
2078         mergeRepositoryBase( builder, target ,source, sourceDominant, context );
2079         mergeRepository_Releases( builder, target, source, sourceDominant, context );
2080         mergeRepository_Snapshots( builder, target, source, sourceDominant, context );
2081     }
2082 
2083     protected void mergeRepository_Id( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2084     {
2085         String src = source.getId();
2086         String tgt = target.getId();
2087         if ( src != null && ( sourceDominant || tgt == null ) )
2088         {
2089             builder.id( src );
2090             builder.location( "id", source.getLocation( "id" ) );
2091         }
2092     }
2093     protected void mergeRepository_Name( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2094     {
2095         String src = source.getName();
2096         String tgt = target.getName();
2097         if ( src != null && ( sourceDominant || tgt == null ) )
2098         {
2099             builder.name( src );
2100             builder.location( "name", source.getLocation( "name" ) );
2101         }
2102     }
2103     protected void mergeRepository_Url( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2104     {
2105         String src = source.getUrl();
2106         String tgt = target.getUrl();
2107         if ( src != null && ( sourceDominant || tgt == null ) )
2108         {
2109             builder.url( src );
2110             builder.location( "url", source.getLocation( "url" ) );
2111         }
2112     }
2113     protected void mergeRepository_Layout( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2114     {
2115         String src = source.getLayout();
2116         String tgt = target.getLayout();
2117         if ( src != null && ( sourceDominant || tgt == null ) )
2118         {
2119             builder.layout( src );
2120             builder.location( "layout", source.getLocation( "layout" ) );
2121         }
2122     }
2123     protected void mergeRepository_Releases( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2124     {
2125         RepositoryPolicy src = source.getReleases();
2126         if ( src != null )
2127         {
2128             RepositoryPolicy tgt = target.getReleases();
2129             if ( tgt == null )
2130             {
2131                 tgt = RepositoryPolicy.newInstance( false );
2132             }
2133             RepositoryPolicy merged = mergeRepositoryPolicy( tgt, src, sourceDominant, context );
2134             if ( merged == src )
2135             {
2136                 builder.releases( merged );
2137                 builder.location( "releases", source.getLocation( "releases" ) );
2138             }
2139             else if ( merged != tgt )
2140             {
2141                 builder.releases( merged );
2142                 builder.location( "releases", InputLocation.merge( target.getLocation( "releases" ), source.getLocation( "releases" ), sourceDominant ) );
2143             }
2144         }
2145     }
2146     protected void mergeRepository_Snapshots( Repository.Builder builder, Repository target, Repository source, boolean sourceDominant, Map<Object, Object> context )
2147     {
2148         RepositoryPolicy src = source.getSnapshots();
2149         if ( src != null )
2150         {
2151             RepositoryPolicy tgt = target.getSnapshots();
2152             if ( tgt == null )
2153             {
2154                 tgt = RepositoryPolicy.newInstance( false );
2155             }
2156             RepositoryPolicy merged = mergeRepositoryPolicy( tgt, src, sourceDominant, context );
2157             if ( merged == src )
2158             {
2159                 builder.snapshots( merged );
2160                 builder.location( "snapshots", source.getLocation( "snapshots" ) );
2161             }
2162             else if ( merged != tgt )
2163             {
2164                 builder.snapshots( merged );
2165                 builder.location( "snapshots", InputLocation.merge( target.getLocation( "snapshots" ), source.getLocation( "snapshots" ), sourceDominant ) );
2166             }
2167         }
2168     }
2169 
2170     protected DeploymentRepository mergeDeploymentRepository( DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2171     {
2172         DeploymentRepository.Builder builder = DeploymentRepository.newBuilder( target );
2173         mergeDeploymentRepository( builder, target, source, sourceDominant, context );
2174         return builder.build();
2175     }
2176 
2177     protected void mergeDeploymentRepository( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2178     {
2179         mergeRepository( builder, target ,source, sourceDominant, context );
2180         mergeDeploymentRepository_UniqueVersion( builder, target, source, sourceDominant, context );
2181     }
2182 
2183     protected void mergeDeploymentRepository_Id( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2184     {
2185         String src = source.getId();
2186         String tgt = target.getId();
2187         if ( src != null && ( sourceDominant || tgt == null ) )
2188         {
2189             builder.id( src );
2190             builder.location( "id", source.getLocation( "id" ) );
2191         }
2192     }
2193     protected void mergeDeploymentRepository_Name( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2194     {
2195         String src = source.getName();
2196         String tgt = target.getName();
2197         if ( src != null && ( sourceDominant || tgt == null ) )
2198         {
2199             builder.name( src );
2200             builder.location( "name", source.getLocation( "name" ) );
2201         }
2202     }
2203     protected void mergeDeploymentRepository_Url( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2204     {
2205         String src = source.getUrl();
2206         String tgt = target.getUrl();
2207         if ( src != null && ( sourceDominant || tgt == null ) )
2208         {
2209             builder.url( src );
2210             builder.location( "url", source.getLocation( "url" ) );
2211         }
2212     }
2213     protected void mergeDeploymentRepository_Layout( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2214     {
2215         String src = source.getLayout();
2216         String tgt = target.getLayout();
2217         if ( src != null && ( sourceDominant || tgt == null ) )
2218         {
2219             builder.layout( src );
2220             builder.location( "layout", source.getLocation( "layout" ) );
2221         }
2222     }
2223     protected void mergeDeploymentRepository_Releases( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2224     {
2225         RepositoryPolicy src = source.getReleases();
2226         if ( src != null )
2227         {
2228             RepositoryPolicy tgt = target.getReleases();
2229             if ( tgt == null )
2230             {
2231                 tgt = RepositoryPolicy.newInstance( false );
2232             }
2233             RepositoryPolicy merged = mergeRepositoryPolicy( tgt, src, sourceDominant, context );
2234             if ( merged == src )
2235             {
2236                 builder.releases( merged );
2237                 builder.location( "releases", source.getLocation( "releases" ) );
2238             }
2239             else if ( merged != tgt )
2240             {
2241                 builder.releases( merged );
2242                 builder.location( "releases", InputLocation.merge( target.getLocation( "releases" ), source.getLocation( "releases" ), sourceDominant ) );
2243             }
2244         }
2245     }
2246     protected void mergeDeploymentRepository_Snapshots( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2247     {
2248         RepositoryPolicy src = source.getSnapshots();
2249         if ( src != null )
2250         {
2251             RepositoryPolicy tgt = target.getSnapshots();
2252             if ( tgt == null )
2253             {
2254                 tgt = RepositoryPolicy.newInstance( false );
2255             }
2256             RepositoryPolicy merged = mergeRepositoryPolicy( tgt, src, sourceDominant, context );
2257             if ( merged == src )
2258             {
2259                 builder.snapshots( merged );
2260                 builder.location( "snapshots", source.getLocation( "snapshots" ) );
2261             }
2262             else if ( merged != tgt )
2263             {
2264                 builder.snapshots( merged );
2265                 builder.location( "snapshots", InputLocation.merge( target.getLocation( "snapshots" ), source.getLocation( "snapshots" ), sourceDominant ) );
2266             }
2267         }
2268     }
2269     protected void mergeDeploymentRepository_UniqueVersion( DeploymentRepository.Builder builder, DeploymentRepository target, DeploymentRepository source, boolean sourceDominant, Map<Object, Object> context )
2270     {
2271         if ( sourceDominant )
2272         {
2273             builder.uniqueVersion( source.isUniqueVersion() );
2274         }
2275     }
2276 
2277     protected RepositoryPolicy mergeRepositoryPolicy( RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant, Map<Object, Object> context )
2278     {
2279         RepositoryPolicy.Builder builder = RepositoryPolicy.newBuilder( target );
2280         mergeRepositoryPolicy( builder, target, source, sourceDominant, context );
2281         return builder.build();
2282     }
2283 
2284     protected void mergeRepositoryPolicy( RepositoryPolicy.Builder builder, RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant, Map<Object, Object> context )
2285     {
2286         mergeRepositoryPolicy_Enabled( builder, target, source, sourceDominant, context );
2287         mergeRepositoryPolicy_UpdatePolicy( builder, target, source, sourceDominant, context );
2288         mergeRepositoryPolicy_ChecksumPolicy( builder, target, source, sourceDominant, context );
2289     }
2290 
2291     protected void mergeRepositoryPolicy_Enabled( RepositoryPolicy.Builder builder, RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant, Map<Object, Object> context )
2292     {
2293         String src = source.getEnabled();
2294         String tgt = target.getEnabled();
2295         if ( src != null && ( sourceDominant || tgt == null ) )
2296         {
2297             builder.enabled( src );
2298             builder.location( "enabled", source.getLocation( "enabled" ) );
2299         }
2300     }
2301     protected void mergeRepositoryPolicy_UpdatePolicy( RepositoryPolicy.Builder builder, RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant, Map<Object, Object> context )
2302     {
2303         String src = source.getUpdatePolicy();
2304         String tgt = target.getUpdatePolicy();
2305         if ( src != null && ( sourceDominant || tgt == null ) )
2306         {
2307             builder.updatePolicy( src );
2308             builder.location( "updatePolicy", source.getLocation( "updatePolicy" ) );
2309         }
2310     }
2311     protected void mergeRepositoryPolicy_ChecksumPolicy( RepositoryPolicy.Builder builder, RepositoryPolicy target, RepositoryPolicy source, boolean sourceDominant, Map<Object, Object> context )
2312     {
2313         String src = source.getChecksumPolicy();
2314         String tgt = target.getChecksumPolicy();
2315         if ( src != null && ( sourceDominant || tgt == null ) )
2316         {
2317             builder.checksumPolicy( src );
2318             builder.location( "checksumPolicy", source.getLocation( "checksumPolicy" ) );
2319         }
2320     }
2321 
2322     protected Site mergeSite( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
2323     {
2324         Site.Builder builder = Site.newBuilder( target );
2325         mergeSite( builder, target, source, sourceDominant, context );
2326         return builder.build();
2327     }
2328 
2329     protected void mergeSite( Site.Builder builder, Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
2330     {
2331         mergeSite_Id( builder, target, source, sourceDominant, context );
2332         mergeSite_Name( builder, target, source, sourceDominant, context );
2333         mergeSite_Url( builder, target, source, sourceDominant, context );
2334         mergeSite_ChildSiteUrlInheritAppendPath( builder, target, source, sourceDominant, context );
2335     }
2336 
2337     protected void mergeSite_Id( Site.Builder builder, Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
2338     {
2339         String src = source.getId();
2340         String tgt = target.getId();
2341         if ( src != null && ( sourceDominant || tgt == null ) )
2342         {
2343             builder.id( src );
2344             builder.location( "id", source.getLocation( "id" ) );
2345         }
2346     }
2347     protected void mergeSite_Name( Site.Builder builder, Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
2348     {
2349         String src = source.getName();
2350         String tgt = target.getName();
2351         if ( src != null && ( sourceDominant || tgt == null ) )
2352         {
2353             builder.name( src );
2354             builder.location( "name", source.getLocation( "name" ) );
2355         }
2356     }
2357     protected void mergeSite_Url( Site.Builder builder, Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
2358     {
2359         String src = source.getUrl();
2360         String tgt = target.getUrl();
2361         if ( src != null && ( sourceDominant || tgt == null ) )
2362         {
2363             builder.url( src );
2364             builder.location( "url", source.getLocation( "url" ) );
2365         }
2366     }
2367     protected void mergeSite_ChildSiteUrlInheritAppendPath( Site.Builder builder, Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
2368     {
2369         String src = source.getChildSiteUrlInheritAppendPath();
2370         String tgt = target.getChildSiteUrlInheritAppendPath();
2371         if ( src != null && ( sourceDominant || tgt == null ) )
2372         {
2373             builder.childSiteUrlInheritAppendPath( src );
2374             builder.location( "childSiteUrlInheritAppendPath", source.getLocation( "childSiteUrlInheritAppendPath" ) );
2375         }
2376     }
2377 
2378     protected ConfigurationContainer mergeConfigurationContainer( ConfigurationContainer target, ConfigurationContainer source, boolean sourceDominant, Map<Object, Object> context )
2379     {
2380         ConfigurationContainer.Builder builder = ConfigurationContainer.newBuilder( target );
2381         mergeConfigurationContainer( builder, target, source, sourceDominant, context );
2382         return builder.build();
2383     }
2384 
2385     protected void mergeConfigurationContainer( ConfigurationContainer.Builder builder, ConfigurationContainer target, ConfigurationContainer source, boolean sourceDominant, Map<Object, Object> context )
2386     {
2387         mergeConfigurationContainer_Inherited( builder, target, source, sourceDominant, context );
2388         mergeConfigurationContainer_Configuration( builder, target, source, sourceDominant, context );
2389     }
2390 
2391     protected void mergeConfigurationContainer_Inherited( ConfigurationContainer.Builder builder, ConfigurationContainer target, ConfigurationContainer source, boolean sourceDominant, Map<Object, Object> context )
2392     {
2393         String src = source.getInherited();
2394         String tgt = target.getInherited();
2395         if ( src != null && ( sourceDominant || tgt == null ) )
2396         {
2397             builder.inherited( src );
2398             builder.location( "inherited", source.getLocation( "inherited" ) );
2399         }
2400     }
2401     protected void mergeConfigurationContainer_Configuration( ConfigurationContainer.Builder builder, ConfigurationContainer target, ConfigurationContainer source, boolean sourceDominant, Map<Object, Object> context )
2402     {
2403         Dom src = source.getConfiguration();
2404         if ( src != null )
2405         {
2406             Dom tgt = target.getConfiguration();
2407             if ( tgt == null )
2408             {
2409                 builder.configuration( src );
2410             }
2411             else if ( sourceDominant )
2412             {
2413                 builder.configuration( src.merge( tgt ) );
2414             }
2415             else
2416             {
2417                 builder.configuration( tgt.merge( src ) );
2418             }
2419         }
2420     }
2421 
2422     protected Plugin mergePlugin( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2423     {
2424         Plugin.Builder builder = Plugin.newBuilder( target );
2425         mergePlugin( builder, target, source, sourceDominant, context );
2426         return builder.build();
2427     }
2428 
2429     protected void mergePlugin( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2430     {
2431         mergeConfigurationContainer( builder, target ,source, sourceDominant, context );
2432         mergePlugin_GroupId( builder, target, source, sourceDominant, context );
2433         mergePlugin_ArtifactId( builder, target, source, sourceDominant, context );
2434         mergePlugin_Version( builder, target, source, sourceDominant, context );
2435         mergePlugin_Extensions( builder, target, source, sourceDominant, context );
2436         mergePlugin_Executions( builder, target, source, sourceDominant, context );
2437         mergePlugin_Dependencies( builder, target, source, sourceDominant, context );
2438     }
2439 
2440     protected void mergePlugin_Inherited( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2441     {
2442         String src = source.getInherited();
2443         String tgt = target.getInherited();
2444         if ( src != null && ( sourceDominant || tgt == null ) )
2445         {
2446             builder.inherited( src );
2447             builder.location( "inherited", source.getLocation( "inherited" ) );
2448         }
2449     }
2450     protected void mergePlugin_Configuration( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2451     {
2452         Dom src = source.getConfiguration();
2453         if ( src != null )
2454         {
2455             Dom tgt = target.getConfiguration();
2456             if ( tgt == null )
2457             {
2458                 builder.configuration( src );
2459             }
2460             else if ( sourceDominant )
2461             {
2462                 builder.configuration( src.merge( tgt ) );
2463             }
2464             else
2465             {
2466                 builder.configuration( tgt.merge( src ) );
2467             }
2468         }
2469     }
2470     protected void mergePlugin_GroupId( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2471     {
2472         String src = source.getGroupId();
2473         String tgt = target.getGroupId();
2474         if ( src != null && ( sourceDominant || tgt == null ) )
2475         {
2476             builder.groupId( src );
2477             builder.location( "groupId", source.getLocation( "groupId" ) );
2478         }
2479     }
2480     protected void mergePlugin_ArtifactId( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2481     {
2482         String src = source.getArtifactId();
2483         String tgt = target.getArtifactId();
2484         if ( src != null && ( sourceDominant || tgt == null ) )
2485         {
2486             builder.artifactId( src );
2487             builder.location( "artifactId", source.getLocation( "artifactId" ) );
2488         }
2489     }
2490     protected void mergePlugin_Version( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2491     {
2492         String src = source.getVersion();
2493         String tgt = target.getVersion();
2494         if ( src != null && ( sourceDominant || tgt == null ) )
2495         {
2496             builder.version( src );
2497             builder.location( "version", source.getLocation( "version" ) );
2498         }
2499     }
2500     protected void mergePlugin_Extensions( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2501     {
2502         String src = source.getExtensions();
2503         String tgt = target.getExtensions();
2504         if ( src != null && ( sourceDominant || tgt == null ) )
2505         {
2506             builder.extensions( src );
2507             builder.location( "extensions", source.getLocation( "extensions" ) );
2508         }
2509     }
2510     protected void mergePlugin_Executions( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2511     {
2512         builder.executions( merge( target.getExecutions(), source.getExecutions(), sourceDominant, getPluginExecutionKey() ) );
2513     }
2514     protected void mergePlugin_Dependencies( Plugin.Builder builder, Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
2515     {
2516         builder.dependencies( merge( target.getDependencies(), source.getDependencies(), sourceDominant, getDependencyKey() ) );
2517     }
2518 
2519     protected PluginExecution mergePluginExecution( PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2520     {
2521         PluginExecution.Builder builder = PluginExecution.newBuilder( target );
2522         mergePluginExecution( builder, target, source, sourceDominant, context );
2523         return builder.build();
2524     }
2525 
2526     protected void mergePluginExecution( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2527     {
2528         mergeConfigurationContainer( builder, target ,source, sourceDominant, context );
2529         mergePluginExecution_Id( builder, target, source, sourceDominant, context );
2530         mergePluginExecution_Phase( builder, target, source, sourceDominant, context );
2531         mergePluginExecution_Priority( builder, target, source, sourceDominant, context );
2532         mergePluginExecution_Goals( builder, target, source, sourceDominant, context );
2533     }
2534 
2535     protected void mergePluginExecution_Inherited( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2536     {
2537         String src = source.getInherited();
2538         String tgt = target.getInherited();
2539         if ( src != null && ( sourceDominant || tgt == null ) )
2540         {
2541             builder.inherited( src );
2542             builder.location( "inherited", source.getLocation( "inherited" ) );
2543         }
2544     }
2545     protected void mergePluginExecution_Configuration( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2546     {
2547         Dom src = source.getConfiguration();
2548         if ( src != null )
2549         {
2550             Dom tgt = target.getConfiguration();
2551             if ( tgt == null )
2552             {
2553                 builder.configuration( src );
2554             }
2555             else if ( sourceDominant )
2556             {
2557                 builder.configuration( src.merge( tgt ) );
2558             }
2559             else
2560             {
2561                 builder.configuration( tgt.merge( src ) );
2562             }
2563         }
2564     }
2565     protected void mergePluginExecution_Id( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2566     {
2567         String src = source.getId();
2568         String tgt = target.getId();
2569         if ( src != null && ( sourceDominant || tgt == null ) )
2570         {
2571             builder.id( src );
2572             builder.location( "id", source.getLocation( "id" ) );
2573         }
2574     }
2575     protected void mergePluginExecution_Phase( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2576     {
2577         String src = source.getPhase();
2578         String tgt = target.getPhase();
2579         if ( src != null && ( sourceDominant || tgt == null ) )
2580         {
2581             builder.phase( src );
2582             builder.location( "phase", source.getLocation( "phase" ) );
2583         }
2584     }
2585     protected void mergePluginExecution_Priority( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2586     {
2587         if ( sourceDominant )
2588         {
2589             builder.priority( source.getPriority() );
2590         }
2591     }
2592     protected void mergePluginExecution_Goals( PluginExecution.Builder builder, PluginExecution target, PluginExecution source, boolean sourceDominant, Map<Object, Object> context )
2593     {
2594         builder.goals( merge( target.getGoals(), source.getGoals(), sourceDominant, e -> e ) );
2595     }
2596 
2597     protected DependencyManagement mergeDependencyManagement( DependencyManagement target, DependencyManagement source, boolean sourceDominant, Map<Object, Object> context )
2598     {
2599         DependencyManagement.Builder builder = DependencyManagement.newBuilder( target );
2600         mergeDependencyManagement( builder, target, source, sourceDominant, context );
2601         return builder.build();
2602     }
2603 
2604     protected void mergeDependencyManagement( DependencyManagement.Builder builder, DependencyManagement target, DependencyManagement source, boolean sourceDominant, Map<Object, Object> context )
2605     {
2606         mergeDependencyManagement_Dependencies( builder, target, source, sourceDominant, context );
2607     }
2608 
2609     protected void mergeDependencyManagement_Dependencies( DependencyManagement.Builder builder, DependencyManagement target, DependencyManagement source, boolean sourceDominant, Map<Object, Object> context )
2610     {
2611         builder.dependencies( merge( target.getDependencies(), source.getDependencies(), sourceDominant, getDependencyKey() ) );
2612     }
2613 
2614     protected PluginManagement mergePluginManagement( PluginManagement target, PluginManagement source, boolean sourceDominant, Map<Object, Object> context )
2615     {
2616         PluginManagement.Builder builder = PluginManagement.newBuilder( target );
2617         mergePluginManagement( builder, target, source, sourceDominant, context );
2618         return builder.build();
2619     }
2620 
2621     protected void mergePluginManagement( PluginManagement.Builder builder, PluginManagement target, PluginManagement source, boolean sourceDominant, Map<Object, Object> context )
2622     {
2623         mergePluginContainer( builder, target ,source, sourceDominant, context );
2624     }
2625 
2626     protected void mergePluginManagement_Plugins( PluginManagement.Builder builder, PluginManagement target, PluginManagement source, boolean sourceDominant, Map<Object, Object> context )
2627     {
2628         builder.plugins( merge( target.getPlugins(), source.getPlugins(), sourceDominant, getPluginKey() ) );
2629     }
2630 
2631     protected Reporting mergeReporting( Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context )
2632     {
2633         Reporting.Builder builder = Reporting.newBuilder( target );
2634         mergeReporting( builder, target, source, sourceDominant, context );
2635         return builder.build();
2636     }
2637 
2638     protected void mergeReporting( Reporting.Builder builder, Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context )
2639     {
2640         mergeReporting_ExcludeDefaults( builder, target, source, sourceDominant, context );
2641         mergeReporting_OutputDirectory( builder, target, source, sourceDominant, context );
2642         mergeReporting_Plugins( builder, target, source, sourceDominant, context );
2643     }
2644 
2645     protected void mergeReporting_ExcludeDefaults( Reporting.Builder builder, Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context )
2646     {
2647         String src = source.getExcludeDefaults();
2648         String tgt = target.getExcludeDefaults();
2649         if ( src != null && ( sourceDominant || tgt == null ) )
2650         {
2651             builder.excludeDefaults( src );
2652             builder.location( "excludeDefaults", source.getLocation( "excludeDefaults" ) );
2653         }
2654     }
2655     protected void mergeReporting_OutputDirectory( Reporting.Builder builder, Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context )
2656     {
2657         String src = source.getOutputDirectory();
2658         String tgt = target.getOutputDirectory();
2659         if ( src != null && ( sourceDominant || tgt == null ) )
2660         {
2661             builder.outputDirectory( src );
2662             builder.location( "outputDirectory", source.getLocation( "outputDirectory" ) );
2663         }
2664     }
2665     protected void mergeReporting_Plugins( Reporting.Builder builder, Reporting target, Reporting source, boolean sourceDominant, Map<Object, Object> context )
2666     {
2667         builder.plugins( merge( target.getPlugins(), source.getPlugins(), sourceDominant, getReportPluginKey() ) );
2668     }
2669 
2670     protected Profile mergeProfile( Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2671     {
2672         Profile.Builder builder = Profile.newBuilder( target );
2673         mergeProfile( builder, target, source, sourceDominant, context );
2674         return builder.build();
2675     }
2676 
2677     protected void mergeProfile( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2678     {
2679         mergeModelBase( builder, target ,source, sourceDominant, context );
2680         mergeProfile_Id( builder, target, source, sourceDominant, context );
2681         mergeProfile_Activation( builder, target, source, sourceDominant, context );
2682         mergeProfile_Build( builder, target, source, sourceDominant, context );
2683     }
2684 
2685     protected void mergeProfile_Modules( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2686     {
2687         builder.modules( merge( target.getModules(), source.getModules(), sourceDominant, e -> e ) );
2688     }
2689     protected void mergeProfile_DistributionManagement( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2690     {
2691         DistributionManagement src = source.getDistributionManagement();
2692         if ( src != null )
2693         {
2694             DistributionManagement tgt = target.getDistributionManagement();
2695             if ( tgt == null )
2696             {
2697                 tgt = DistributionManagement.newInstance( false );
2698             }
2699             DistributionManagement merged = mergeDistributionManagement( tgt, src, sourceDominant, context );
2700             if ( merged == src )
2701             {
2702                 builder.distributionManagement( merged );
2703                 builder.location( "distributionManagement", source.getLocation( "distributionManagement" ) );
2704             }
2705             else if ( merged != tgt )
2706             {
2707                 builder.distributionManagement( merged );
2708                 builder.location( "distributionManagement", InputLocation.merge( target.getLocation( "distributionManagement" ), source.getLocation( "distributionManagement" ), sourceDominant ) );
2709             }
2710         }
2711     }
2712     protected void mergeProfile_Properties( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2713     {
2714         Map<String, String> src = source.getProperties();
2715         if ( !src.isEmpty() )
2716         {
2717             Map<String, String> tgt = target.getProperties();
2718             if ( tgt.isEmpty() )
2719             {
2720                 builder.properties( src );
2721                 builder.location( "properties", source.getLocation( "properties" ) );
2722             }
2723             else
2724             {
2725                 Map<String, String> merged = new HashMap<>();
2726                 merged.putAll( sourceDominant ? target.getProperties() : source.getProperties() );
2727                 merged.putAll( sourceDominant ? source.getProperties() : target.getProperties() );
2728                 builder.properties( merged );
2729                 builder.location( "properties", InputLocation.merge( target.getLocation( "properties" ), source.getLocation( "properties" ), sourceDominant ) );
2730             }
2731         }
2732     }
2733     protected void mergeProfile_DependencyManagement( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2734     {
2735         DependencyManagement src = source.getDependencyManagement();
2736         if ( src != null )
2737         {
2738             DependencyManagement tgt = target.getDependencyManagement();
2739             if ( tgt == null )
2740             {
2741                 tgt = DependencyManagement.newInstance( false );
2742             }
2743             DependencyManagement merged = mergeDependencyManagement( tgt, src, sourceDominant, context );
2744             if ( merged == src )
2745             {
2746                 builder.dependencyManagement( merged );
2747                 builder.location( "dependencyManagement", source.getLocation( "dependencyManagement" ) );
2748             }
2749             else if ( merged != tgt )
2750             {
2751                 builder.dependencyManagement( merged );
2752                 builder.location( "dependencyManagement", InputLocation.merge( target.getLocation( "dependencyManagement" ), source.getLocation( "dependencyManagement" ), sourceDominant ) );
2753             }
2754         }
2755     }
2756     protected void mergeProfile_Dependencies( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2757     {
2758         builder.dependencies( merge( target.getDependencies(), source.getDependencies(), sourceDominant, getDependencyKey() ) );
2759     }
2760     protected void mergeProfile_Repositories( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2761     {
2762         builder.repositories( merge( target.getRepositories(), source.getRepositories(), sourceDominant, getRepositoryKey() ) );
2763     }
2764     protected void mergeProfile_PluginRepositories( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2765     {
2766         builder.pluginRepositories( merge( target.getPluginRepositories(), source.getPluginRepositories(), sourceDominant, getRepositoryKey() ) );
2767     }
2768     protected void mergeProfile_Reporting( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2769     {
2770         Reporting src = source.getReporting();
2771         if ( src != null )
2772         {
2773             Reporting tgt = target.getReporting();
2774             if ( tgt == null )
2775             {
2776                 tgt = Reporting.newInstance( false );
2777             }
2778             Reporting merged = mergeReporting( tgt, src, sourceDominant, context );
2779             if ( merged == src )
2780             {
2781                 builder.reporting( merged );
2782                 builder.location( "reporting", source.getLocation( "reporting" ) );
2783             }
2784             else if ( merged != tgt )
2785             {
2786                 builder.reporting( merged );
2787                 builder.location( "reporting", InputLocation.merge( target.getLocation( "reporting" ), source.getLocation( "reporting" ), sourceDominant ) );
2788             }
2789         }
2790     }
2791     protected void mergeProfile_Id( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2792     {
2793         String src = source.getId();
2794         String tgt = target.getId();
2795         if ( src != null && ( sourceDominant || tgt == null ) )
2796         {
2797             builder.id( src );
2798             builder.location( "id", source.getLocation( "id" ) );
2799         }
2800     }
2801     protected void mergeProfile_Activation( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2802     {
2803         Activation src = source.getActivation();
2804         if ( src != null )
2805         {
2806             Activation tgt = target.getActivation();
2807             if ( tgt == null )
2808             {
2809                 tgt = Activation.newInstance( false );
2810             }
2811             Activation merged = mergeActivation( tgt, src, sourceDominant, context );
2812             if ( merged == src )
2813             {
2814                 builder.activation( merged );
2815                 builder.location( "activation", source.getLocation( "activation" ) );
2816             }
2817             else if ( merged != tgt )
2818             {
2819                 builder.activation( merged );
2820                 builder.location( "activation", InputLocation.merge( target.getLocation( "activation" ), source.getLocation( "activation" ), sourceDominant ) );
2821             }
2822         }
2823     }
2824     protected void mergeProfile_Build( Profile.Builder builder, Profile target, Profile source, boolean sourceDominant, Map<Object, Object> context )
2825     {
2826         BuildBase src = source.getBuild();
2827         if ( src != null )
2828         {
2829             BuildBase tgt = target.getBuild();
2830             if ( tgt == null )
2831             {
2832                 tgt = BuildBase.newInstance( false );
2833             }
2834             BuildBase merged = mergeBuildBase( tgt, src, sourceDominant, context );
2835             if ( merged == src )
2836             {
2837                 builder.build( merged );
2838                 builder.location( "build", source.getLocation( "build" ) );
2839             }
2840             else if ( merged != tgt )
2841             {
2842                 builder.build( merged );
2843                 builder.location( "build", InputLocation.merge( target.getLocation( "build" ), source.getLocation( "build" ), sourceDominant ) );
2844             }
2845         }
2846     }
2847 
2848     protected Activation mergeActivation( Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2849     {
2850         Activation.Builder builder = Activation.newBuilder( target );
2851         mergeActivation( builder, target, source, sourceDominant, context );
2852         return builder.build();
2853     }
2854 
2855     protected void mergeActivation( Activation.Builder builder, Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2856     {
2857         mergeActivation_ActiveByDefault( builder, target, source, sourceDominant, context );
2858         mergeActivation_Jdk( builder, target, source, sourceDominant, context );
2859         mergeActivation_Os( builder, target, source, sourceDominant, context );
2860         mergeActivation_Property( builder, target, source, sourceDominant, context );
2861         mergeActivation_File( builder, target, source, sourceDominant, context );
2862     }
2863 
2864     protected void mergeActivation_ActiveByDefault( Activation.Builder builder, Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2865     {
2866         if ( sourceDominant )
2867         {
2868             builder.activeByDefault( source.isActiveByDefault() );
2869         }
2870     }
2871     protected void mergeActivation_Jdk( Activation.Builder builder, Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2872     {
2873         String src = source.getJdk();
2874         String tgt = target.getJdk();
2875         if ( src != null && ( sourceDominant || tgt == null ) )
2876         {
2877             builder.jdk( src );
2878             builder.location( "jdk", source.getLocation( "jdk" ) );
2879         }
2880     }
2881     protected void mergeActivation_Os( Activation.Builder builder, Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2882     {
2883         ActivationOS src = source.getOs();
2884         if ( src != null )
2885         {
2886             ActivationOS tgt = target.getOs();
2887             if ( tgt == null )
2888             {
2889                 tgt = ActivationOS.newInstance( false );
2890             }
2891             ActivationOS merged = mergeActivationOS( tgt, src, sourceDominant, context );
2892             if ( merged == src )
2893             {
2894                 builder.os( merged );
2895                 builder.location( "os", source.getLocation( "os" ) );
2896             }
2897             else if ( merged != tgt )
2898             {
2899                 builder.os( merged );
2900                 builder.location( "os", InputLocation.merge( target.getLocation( "os" ), source.getLocation( "os" ), sourceDominant ) );
2901             }
2902         }
2903     }
2904     protected void mergeActivation_Property( Activation.Builder builder, Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2905     {
2906         ActivationProperty src = source.getProperty();
2907         if ( src != null )
2908         {
2909             ActivationProperty tgt = target.getProperty();
2910             if ( tgt == null )
2911             {
2912                 tgt = ActivationProperty.newInstance( false );
2913             }
2914             ActivationProperty merged = mergeActivationProperty( tgt, src, sourceDominant, context );
2915             if ( merged == src )
2916             {
2917                 builder.property( merged );
2918                 builder.location( "property", source.getLocation( "property" ) );
2919             }
2920             else if ( merged != tgt )
2921             {
2922                 builder.property( merged );
2923                 builder.location( "property", InputLocation.merge( target.getLocation( "property" ), source.getLocation( "property" ), sourceDominant ) );
2924             }
2925         }
2926     }
2927     protected void mergeActivation_File( Activation.Builder builder, Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context )
2928     {
2929         ActivationFile src = source.getFile();
2930         if ( src != null )
2931         {
2932             ActivationFile tgt = target.getFile();
2933             if ( tgt == null )
2934             {
2935                 tgt = ActivationFile.newInstance( false );
2936             }
2937             ActivationFile merged = mergeActivationFile( tgt, src, sourceDominant, context );
2938             if ( merged == src )
2939             {
2940                 builder.file( merged );
2941                 builder.location( "file", source.getLocation( "file" ) );
2942             }
2943             else if ( merged != tgt )
2944             {
2945                 builder.file( merged );
2946                 builder.location( "file", InputLocation.merge( target.getLocation( "file" ), source.getLocation( "file" ), sourceDominant ) );
2947             }
2948         }
2949     }
2950 
2951     protected ActivationProperty mergeActivationProperty( ActivationProperty target, ActivationProperty source, boolean sourceDominant, Map<Object, Object> context )
2952     {
2953         ActivationProperty.Builder builder = ActivationProperty.newBuilder( target );
2954         mergeActivationProperty( builder, target, source, sourceDominant, context );
2955         return builder.build();
2956     }
2957 
2958     protected void mergeActivationProperty( ActivationProperty.Builder builder, ActivationProperty target, ActivationProperty source, boolean sourceDominant, Map<Object, Object> context )
2959     {
2960         mergeActivationProperty_Name( builder, target, source, sourceDominant, context );
2961         mergeActivationProperty_Value( builder, target, source, sourceDominant, context );
2962     }
2963 
2964     protected void mergeActivationProperty_Name( ActivationProperty.Builder builder, ActivationProperty target, ActivationProperty source, boolean sourceDominant, Map<Object, Object> context )
2965     {
2966         String src = source.getName();
2967         String tgt = target.getName();
2968         if ( src != null && ( sourceDominant || tgt == null ) )
2969         {
2970             builder.name( src );
2971             builder.location( "name", source.getLocation( "name" ) );
2972         }
2973     }
2974     protected void mergeActivationProperty_Value( ActivationProperty.Builder builder, ActivationProperty target, ActivationProperty source, boolean sourceDominant, Map<Object, Object> context )
2975     {
2976         String src = source.getValue();
2977         String tgt = target.getValue();
2978         if ( src != null && ( sourceDominant || tgt == null ) )
2979         {
2980             builder.value( src );
2981             builder.location( "value", source.getLocation( "value" ) );
2982         }
2983     }
2984 
2985     protected ActivationOS mergeActivationOS( ActivationOS target, ActivationOS source, boolean sourceDominant, Map<Object, Object> context )
2986     {
2987         ActivationOS.Builder builder = ActivationOS.newBuilder( target );
2988         mergeActivationOS( builder, target, source, sourceDominant, context );
2989         return builder.build();
2990     }
2991 
2992     protected void mergeActivationOS( ActivationOS.Builder builder, ActivationOS target, ActivationOS source, boolean sourceDominant, Map<Object, Object> context )
2993     {
2994         mergeActivationOS_Name( builder, target, source, sourceDominant, context );
2995         mergeActivationOS_Family( builder, target, source, sourceDominant, context );
2996         mergeActivationOS_Arch( builder, target, source, sourceDominant, context );
2997         mergeActivationOS_Version( builder, target, source, sourceDominant, context );
2998     }
2999 
3000     protected void mergeActivationOS_Name( ActivationOS.Builder builder, ActivationOS target, ActivationOS source, boolean sourceDominant, Map<Object, Object> context )
3001     {
3002         String src = source.getName();
3003         String tgt = target.getName();
3004         if ( src != null && ( sourceDominant || tgt == null ) )
3005         {
3006             builder.name( src );
3007             builder.location( "name", source.getLocation( "name" ) );
3008         }
3009     }
3010     protected void mergeActivationOS_Family( ActivationOS.Builder builder, ActivationOS target, ActivationOS source, boolean sourceDominant, Map<Object, Object> context )
3011     {
3012         String src = source.getFamily();
3013         String tgt = target.getFamily();
3014         if ( src != null && ( sourceDominant || tgt == null ) )
3015         {
3016             builder.family( src );
3017             builder.location( "family", source.getLocation( "family" ) );
3018         }
3019     }
3020     protected void mergeActivationOS_Arch( ActivationOS.Builder builder, ActivationOS target, ActivationOS source, boolean sourceDominant, Map<Object, Object> context )
3021     {
3022         String src = source.getArch();
3023         String tgt = target.getArch();
3024         if ( src != null && ( sourceDominant || tgt == null ) )
3025         {
3026             builder.arch( src );
3027             builder.location( "arch", source.getLocation( "arch" ) );
3028         }
3029     }
3030     protected void mergeActivationOS_Version( ActivationOS.Builder builder, ActivationOS target, ActivationOS source, boolean sourceDominant, Map<Object, Object> context )
3031     {
3032         String src = source.getVersion();
3033         String tgt = target.getVersion();
3034         if ( src != null && ( sourceDominant || tgt == null ) )
3035         {
3036             builder.version( src );
3037             builder.location( "version", source.getLocation( "version" ) );
3038         }
3039     }
3040 
3041     protected ActivationFile mergeActivationFile( ActivationFile target, ActivationFile source, boolean sourceDominant, Map<Object, Object> context )
3042     {
3043         ActivationFile.Builder builder = ActivationFile.newBuilder( target );
3044         mergeActivationFile( builder, target, source, sourceDominant, context );
3045         return builder.build();
3046     }
3047 
3048     protected void mergeActivationFile( ActivationFile.Builder builder, ActivationFile target, ActivationFile source, boolean sourceDominant, Map<Object, Object> context )
3049     {
3050         mergeActivationFile_Missing( builder, target, source, sourceDominant, context );
3051         mergeActivationFile_Exists( builder, target, source, sourceDominant, context );
3052     }
3053 
3054     protected void mergeActivationFile_Missing( ActivationFile.Builder builder, ActivationFile target, ActivationFile source, boolean sourceDominant, Map<Object, Object> context )
3055     {
3056         String src = source.getMissing();
3057         String tgt = target.getMissing();
3058         if ( src != null && ( sourceDominant || tgt == null ) )
3059         {
3060             builder.missing( src );
3061             builder.location( "missing", source.getLocation( "missing" ) );
3062         }
3063     }
3064     protected void mergeActivationFile_Exists( ActivationFile.Builder builder, ActivationFile target, ActivationFile source, boolean sourceDominant, Map<Object, Object> context )
3065     {
3066         String src = source.getExists();
3067         String tgt = target.getExists();
3068         if ( src != null && ( sourceDominant || tgt == null ) )
3069         {
3070             builder.exists( src );
3071             builder.location( "exists", source.getLocation( "exists" ) );
3072         }
3073     }
3074 
3075     protected ReportPlugin mergeReportPlugin( ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3076     {
3077         ReportPlugin.Builder builder = ReportPlugin.newBuilder( target );
3078         mergeReportPlugin( builder, target, source, sourceDominant, context );
3079         return builder.build();
3080     }
3081 
3082     protected void mergeReportPlugin( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3083     {
3084         mergeConfigurationContainer( builder, target ,source, sourceDominant, context );
3085         mergeReportPlugin_GroupId( builder, target, source, sourceDominant, context );
3086         mergeReportPlugin_ArtifactId( builder, target, source, sourceDominant, context );
3087         mergeReportPlugin_Version( builder, target, source, sourceDominant, context );
3088         mergeReportPlugin_ReportSets( builder, target, source, sourceDominant, context );
3089     }
3090 
3091     protected void mergeReportPlugin_Inherited( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3092     {
3093         String src = source.getInherited();
3094         String tgt = target.getInherited();
3095         if ( src != null && ( sourceDominant || tgt == null ) )
3096         {
3097             builder.inherited( src );
3098             builder.location( "inherited", source.getLocation( "inherited" ) );
3099         }
3100     }
3101     protected void mergeReportPlugin_Configuration( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3102     {
3103         Dom src = source.getConfiguration();
3104         if ( src != null )
3105         {
3106             Dom tgt = target.getConfiguration();
3107             if ( tgt == null )
3108             {
3109                 builder.configuration( src );
3110             }
3111             else if ( sourceDominant )
3112             {
3113                 builder.configuration( src.merge( tgt ) );
3114             }
3115             else
3116             {
3117                 builder.configuration( tgt.merge( src ) );
3118             }
3119         }
3120     }
3121     protected void mergeReportPlugin_GroupId( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3122     {
3123         String src = source.getGroupId();
3124         String tgt = target.getGroupId();
3125         if ( src != null && ( sourceDominant || tgt == null ) )
3126         {
3127             builder.groupId( src );
3128             builder.location( "groupId", source.getLocation( "groupId" ) );
3129         }
3130     }
3131     protected void mergeReportPlugin_ArtifactId( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3132     {
3133         String src = source.getArtifactId();
3134         String tgt = target.getArtifactId();
3135         if ( src != null && ( sourceDominant || tgt == null ) )
3136         {
3137             builder.artifactId( src );
3138             builder.location( "artifactId", source.getLocation( "artifactId" ) );
3139         }
3140     }
3141     protected void mergeReportPlugin_Version( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3142     {
3143         String src = source.getVersion();
3144         String tgt = target.getVersion();
3145         if ( src != null && ( sourceDominant || tgt == null ) )
3146         {
3147             builder.version( src );
3148             builder.location( "version", source.getLocation( "version" ) );
3149         }
3150     }
3151     protected void mergeReportPlugin_ReportSets( ReportPlugin.Builder builder, ReportPlugin target, ReportPlugin source, boolean sourceDominant, Map<Object, Object> context )
3152     {
3153         builder.reportSets( merge( target.getReportSets(), source.getReportSets(), sourceDominant, getReportSetKey() ) );
3154     }
3155 
3156     protected ReportSet mergeReportSet( ReportSet target, ReportSet source, boolean sourceDominant, Map<Object, Object> context )
3157     {
3158         ReportSet.Builder builder = ReportSet.newBuilder( target );
3159         mergeReportSet( builder, target, source, sourceDominant, context );
3160         return builder.build();
3161     }
3162 
3163     protected void mergeReportSet( ReportSet.Builder builder, ReportSet target, ReportSet source, boolean sourceDominant, Map<Object, Object> context )
3164     {
3165         mergeConfigurationContainer( builder, target ,source, sourceDominant, context );
3166         mergeReportSet_Id( builder, target, source, sourceDominant, context );
3167         mergeReportSet_Reports( builder, target, source, sourceDominant, context );
3168     }
3169 
3170     protected void mergeReportSet_Inherited( ReportSet.Builder builder, ReportSet target, ReportSet source, boolean sourceDominant, Map<Object, Object> context )
3171     {
3172         String src = source.getInherited();
3173         String tgt = target.getInherited();
3174         if ( src != null && ( sourceDominant || tgt == null ) )
3175         {
3176             builder.inherited( src );
3177             builder.location( "inherited", source.getLocation( "inherited" ) );
3178         }
3179     }
3180     protected void mergeReportSet_Configuration( ReportSet.Builder builder, ReportSet target, ReportSet source, boolean sourceDominant, Map<Object, Object> context )
3181     {
3182         Dom src = source.getConfiguration();
3183         if ( src != null )
3184         {
3185             Dom tgt = target.getConfiguration();
3186             if ( tgt == null )
3187             {
3188                 builder.configuration( src );
3189             }
3190             else if ( sourceDominant )
3191             {
3192                 builder.configuration( src.merge( tgt ) );
3193             }
3194             else
3195             {
3196                 builder.configuration( tgt.merge( src ) );
3197             }
3198         }
3199     }
3200     protected void mergeReportSet_Id( ReportSet.Builder builder, ReportSet target, ReportSet source, boolean sourceDominant, Map<Object, Object> context )
3201     {
3202         String src = source.getId();
3203         String tgt = target.getId();
3204         if ( src != null && ( sourceDominant || tgt == null ) )
3205         {
3206             builder.id( src );
3207             builder.location( "id", source.getLocation( "id" ) );
3208         }
3209     }
3210     protected void mergeReportSet_Reports( ReportSet.Builder builder, ReportSet target, ReportSet source, boolean sourceDominant, Map<Object, Object> context )
3211     {
3212         builder.reports( merge( target.getReports(), source.getReports(), sourceDominant, e -> e ) );
3213     }
3214 
3215     protected Prerequisites mergePrerequisites( Prerequisites target, Prerequisites source, boolean sourceDominant, Map<Object, Object> context )
3216     {
3217         Prerequisites.Builder builder = Prerequisites.newBuilder( target );
3218         mergePrerequisites( builder, target, source, sourceDominant, context );
3219         return builder.build();
3220     }
3221 
3222     protected void mergePrerequisites( Prerequisites.Builder builder, Prerequisites target, Prerequisites source, boolean sourceDominant, Map<Object, Object> context )
3223     {
3224         mergePrerequisites_Maven( builder, target, source, sourceDominant, context );
3225     }
3226 
3227     protected void mergePrerequisites_Maven( Prerequisites.Builder builder, Prerequisites target, Prerequisites source, boolean sourceDominant, Map<Object, Object> context )
3228     {
3229         String src = source.getMaven();
3230         String tgt = target.getMaven();
3231         if ( src != null && ( sourceDominant || tgt == null ) )
3232         {
3233             builder.maven( src );
3234             builder.location( "maven", source.getLocation( "maven" ) );
3235         }
3236     }
3237 
3238     protected Relocation mergeRelocation( Relocation target, Relocation source, boolean sourceDominant, Map<Object, Object> context )
3239     {
3240         Relocation.Builder builder = Relocation.newBuilder( target );
3241         mergeRelocation( builder, target, source, sourceDominant, context );
3242         return builder.build();
3243     }
3244 
3245     protected void mergeRelocation( Relocation.Builder builder, Relocation target, Relocation source, boolean sourceDominant, Map<Object, Object> context )
3246     {
3247         mergeRelocation_GroupId( builder, target, source, sourceDominant, context );
3248         mergeRelocation_ArtifactId( builder, target, source, sourceDominant, context );
3249         mergeRelocation_Version( builder, target, source, sourceDominant, context );
3250         mergeRelocation_Message( builder, target, source, sourceDominant, context );
3251     }
3252 
3253     protected void mergeRelocation_GroupId( Relocation.Builder builder, Relocation target, Relocation source, boolean sourceDominant, Map<Object, Object> context )
3254     {
3255         String src = source.getGroupId();
3256         String tgt = target.getGroupId();
3257         if ( src != null && ( sourceDominant || tgt == null ) )
3258         {
3259             builder.groupId( src );
3260             builder.location( "groupId", source.getLocation( "groupId" ) );
3261         }
3262     }
3263     protected void mergeRelocation_ArtifactId( Relocation.Builder builder, Relocation target, Relocation source, boolean sourceDominant, Map<Object, Object> context )
3264     {
3265         String src = source.getArtifactId();
3266         String tgt = target.getArtifactId();
3267         if ( src != null && ( sourceDominant || tgt == null ) )
3268         {
3269             builder.artifactId( src );
3270             builder.location( "artifactId", source.getLocation( "artifactId" ) );
3271         }
3272     }
3273     protected void mergeRelocation_Version( Relocation.Builder builder, Relocation target, Relocation source, boolean sourceDominant, Map<Object, Object> context )
3274     {
3275         String src = source.getVersion();
3276         String tgt = target.getVersion();
3277         if ( src != null && ( sourceDominant || tgt == null ) )
3278         {
3279             builder.version( src );
3280             builder.location( "version", source.getLocation( "version" ) );
3281         }
3282     }
3283     protected void mergeRelocation_Message( Relocation.Builder builder, Relocation target, Relocation source, boolean sourceDominant, Map<Object, Object> context )
3284     {
3285         String src = source.getMessage();
3286         String tgt = target.getMessage();
3287         if ( src != null && ( sourceDominant || tgt == null ) )
3288         {
3289             builder.message( src );
3290             builder.location( "message", source.getLocation( "message" ) );
3291         }
3292     }
3293 
3294     protected Extension mergeExtension( Extension target, Extension source, boolean sourceDominant, Map<Object, Object> context )
3295     {
3296         Extension.Builder builder = Extension.newBuilder( target );
3297         mergeExtension( builder, target, source, sourceDominant, context );
3298         return builder.build();
3299     }
3300 
3301     protected void mergeExtension( Extension.Builder builder, Extension target, Extension source, boolean sourceDominant, Map<Object, Object> context )
3302     {
3303         mergeExtension_GroupId( builder, target, source, sourceDominant, context );
3304         mergeExtension_ArtifactId( builder, target, source, sourceDominant, context );
3305         mergeExtension_Version( builder, target, source, sourceDominant, context );
3306     }
3307 
3308     protected void mergeExtension_GroupId( Extension.Builder builder, Extension target, Extension source, boolean sourceDominant, Map<Object, Object> context )
3309     {
3310         String src = source.getGroupId();
3311         String tgt = target.getGroupId();
3312         if ( src != null && ( sourceDominant || tgt == null ) )
3313         {
3314             builder.groupId( src );
3315             builder.location( "groupId", source.getLocation( "groupId" ) );
3316         }
3317     }
3318     protected void mergeExtension_ArtifactId( Extension.Builder builder, Extension target, Extension source, boolean sourceDominant, Map<Object, Object> context )
3319     {
3320         String src = source.getArtifactId();
3321         String tgt = target.getArtifactId();
3322         if ( src != null && ( sourceDominant || tgt == null ) )
3323         {
3324             builder.artifactId( src );
3325             builder.location( "artifactId", source.getLocation( "artifactId" ) );
3326         }
3327     }
3328     protected void mergeExtension_Version( Extension.Builder builder, Extension target, Extension source, boolean sourceDominant, Map<Object, Object> context )
3329     {
3330         String src = source.getVersion();
3331         String tgt = target.getVersion();
3332         if ( src != null && ( sourceDominant || tgt == null ) )
3333         {
3334             builder.version( src );
3335             builder.location( "version", source.getLocation( "version" ) );
3336         }
3337     }
3338 
3339 
3340     protected KeyComputer<Model> getModelKey()
3341     {
3342         return v -> v;
3343     }
3344     protected KeyComputer<ModelBase> getModelBaseKey()
3345     {
3346         return v -> v;
3347     }
3348     protected KeyComputer<PluginContainer> getPluginContainerKey()
3349     {
3350         return v -> v;
3351     }
3352     protected KeyComputer<PluginConfiguration> getPluginConfigurationKey()
3353     {
3354         return v -> v;
3355     }
3356     protected KeyComputer<BuildBase> getBuildBaseKey()
3357     {
3358         return v -> v;
3359     }
3360     protected KeyComputer<Build> getBuildKey()
3361     {
3362         return v -> v;
3363     }
3364     protected KeyComputer<CiManagement> getCiManagementKey()
3365     {
3366         return v -> v;
3367     }
3368     protected KeyComputer<Notifier> getNotifierKey()
3369     {
3370         return v -> v;
3371     }
3372     protected KeyComputer<Contributor> getContributorKey()
3373     {
3374         return v -> v;
3375     }
3376     protected KeyComputer<Dependency> getDependencyKey()
3377     {
3378         return v -> v;
3379     }
3380     protected KeyComputer<Developer> getDeveloperKey()
3381     {
3382         return v -> v;
3383     }
3384     protected KeyComputer<Exclusion> getExclusionKey()
3385     {
3386         return v -> v;
3387     }
3388     protected KeyComputer<IssueManagement> getIssueManagementKey()
3389     {
3390         return v -> v;
3391     }
3392     protected KeyComputer<DistributionManagement> getDistributionManagementKey()
3393     {
3394         return v -> v;
3395     }
3396     protected KeyComputer<License> getLicenseKey()
3397     {
3398         return v -> v;
3399     }
3400     protected KeyComputer<MailingList> getMailingListKey()
3401     {
3402         return v -> v;
3403     }
3404     protected KeyComputer<Organization> getOrganizationKey()
3405     {
3406         return v -> v;
3407     }
3408     protected KeyComputer<PatternSet> getPatternSetKey()
3409     {
3410         return v -> v;
3411     }
3412     protected KeyComputer<Parent> getParentKey()
3413     {
3414         return v -> v;
3415     }
3416     protected KeyComputer<Scm> getScmKey()
3417     {
3418         return v -> v;
3419     }
3420     protected KeyComputer<FileSet> getFileSetKey()
3421     {
3422         return v -> v;
3423     }
3424     protected KeyComputer<Resource> getResourceKey()
3425     {
3426         return v -> v;
3427     }
3428     protected KeyComputer<RepositoryBase> getRepositoryBaseKey()
3429     {
3430         return v -> v;
3431     }
3432     protected KeyComputer<Repository> getRepositoryKey()
3433     {
3434         return v -> v;
3435     }
3436     protected KeyComputer<DeploymentRepository> getDeploymentRepositoryKey()
3437     {
3438         return v -> v;
3439     }
3440     protected KeyComputer<RepositoryPolicy> getRepositoryPolicyKey()
3441     {
3442         return v -> v;
3443     }
3444     protected KeyComputer<Site> getSiteKey()
3445     {
3446         return v -> v;
3447     }
3448     protected KeyComputer<ConfigurationContainer> getConfigurationContainerKey()
3449     {
3450         return v -> v;
3451     }
3452     protected KeyComputer<Plugin> getPluginKey()
3453     {
3454         return v -> v;
3455     }
3456     protected KeyComputer<PluginExecution> getPluginExecutionKey()
3457     {
3458         return v -> v;
3459     }
3460     protected KeyComputer<DependencyManagement> getDependencyManagementKey()
3461     {
3462         return v -> v;
3463     }
3464     protected KeyComputer<PluginManagement> getPluginManagementKey()
3465     {
3466         return v -> v;
3467     }
3468     protected KeyComputer<Reporting> getReportingKey()
3469     {
3470         return v -> v;
3471     }
3472     protected KeyComputer<Profile> getProfileKey()
3473     {
3474         return v -> v;
3475     }
3476     protected KeyComputer<Activation> getActivationKey()
3477     {
3478         return v -> v;
3479     }
3480     protected KeyComputer<ActivationProperty> getActivationPropertyKey()
3481     {
3482         return v -> v;
3483     }
3484     protected KeyComputer<ActivationOS> getActivationOSKey()
3485     {
3486         return v -> v;
3487     }
3488     protected KeyComputer<ActivationFile> getActivationFileKey()
3489     {
3490         return v -> v;
3491     }
3492     protected KeyComputer<ReportPlugin> getReportPluginKey()
3493     {
3494         return v -> v;
3495     }
3496     protected KeyComputer<ReportSet> getReportSetKey()
3497     {
3498         return v -> v;
3499     }
3500     protected KeyComputer<Prerequisites> getPrerequisitesKey()
3501     {
3502         return v -> v;
3503     }
3504     protected KeyComputer<Relocation> getRelocationKey()
3505     {
3506         return v -> v;
3507     }
3508     protected KeyComputer<Extension> getExtensionKey()
3509     {
3510         return v -> v;
3511     }
3512 
3513     /**
3514      * Use to compute keys for data structures
3515      * @param <T> the data structure type
3516      */
3517     @FunctionalInterface
3518     public interface KeyComputer<T> extends Function<T, Object>
3519     {
3520     }
3521 
3522     /**
3523      * Merge two lists
3524      */
3525     public static <T> List<T> merge( List<T> tgt, List<T> src, boolean sourceDominant, KeyComputer<T> computer )
3526     {
3527         return merge( tgt, src, computer, ( t, s ) -> sourceDominant ? s : t );
3528     }
3529 
3530     public static <T> List<T> merge( List<T> tgt, List<T> src, KeyComputer<T> computer, BinaryOperator<T> remapping )
3531     {
3532         if ( src.isEmpty() )
3533         {
3534             return tgt;
3535         }
3536 
3537         MergingList<T> list;
3538         if ( tgt instanceof MergingList )
3539         {
3540             list = (MergingList<T>) tgt;
3541         }
3542         else
3543         {
3544             list = new MergingList<>( computer, src.size() + tgt.size() );
3545             list.mergeAll( tgt, ( t, s ) -> s );
3546         }
3547 
3548         list.mergeAll( src, remapping );
3549         return list;
3550     }
3551 
3552     /**
3553      * Merging list
3554      * @param <V>
3555      */
3556     private static class MergingList<V> extends AbstractList<V> implements java.io.Serializable
3557     {
3558 
3559         private final KeyComputer<V> keyComputer;
3560         private Map<Object, V> map;
3561         private List<V> list;
3562 
3563         MergingList( KeyComputer<V> keyComputer, int initialCapacity )
3564         {
3565             this.map = new LinkedHashMap<>( initialCapacity );
3566             this.keyComputer = keyComputer;
3567         }
3568 
3569         Object writeReplace() throws ObjectStreamException
3570         {
3571             return new ArrayList<>( this );
3572         }
3573 
3574         @Override
3575         public Iterator<V> iterator()
3576         {
3577             if ( map != null )
3578             {
3579                 return map.values().iterator();
3580             }
3581             else
3582             {
3583                 return list.iterator();
3584             }
3585         }
3586 
3587         void mergeAll( Collection<V> vs, BinaryOperator<V> remapping )
3588         {
3589             if ( map == null )
3590             {
3591                 map = list.stream().collect( Collectors.toMap( keyComputer,
3592                                                                Function.identity(),
3593                                                                null,
3594                                                                LinkedHashMap::new ) );
3595 
3596                 list = null;
3597             }
3598 
3599             if ( vs instanceof MergingList && ( (MergingList<V>) vs ).map != null )
3600             {
3601                 for ( Map.Entry<Object, V> e : ( (MergingList<V>) vs ).map.entrySet() )
3602                 {
3603                     Object key = e.getKey();
3604                     V v = e.getValue();
3605                     map.merge( key, v, remapping );
3606                 }
3607             }
3608             else
3609             {
3610                 for ( V v : vs )
3611                 {
3612                     Object key = keyComputer.apply( v );
3613 
3614                     map.merge( key, v, remapping );
3615                 }
3616             }
3617         }
3618 
3619         @Override
3620         public boolean contains( Object o )
3621         {
3622             if ( map != null )
3623             {
3624                 return map.containsValue( o );
3625             }
3626             else
3627             {
3628                 return list.contains( o );
3629             }
3630         }
3631 
3632         private List<V> asList()
3633         {
3634             if ( list == null )
3635             {
3636                 list = new ArrayList<>( map.values() );
3637                 map = null;
3638             }
3639             return list;
3640         }
3641 
3642         @Override
3643         public void add( int index, V element )
3644         {
3645             asList().add( index, element );
3646         }
3647 
3648         @Override
3649         public V remove( int index )
3650         {
3651             return asList().remove( index );
3652         }
3653 
3654         @Override
3655         public V get( int index )
3656         {
3657             return asList().get( index );
3658         }
3659 
3660         @Override
3661         public int size()
3662         {
3663             if ( map != null )
3664             {
3665                 return map.size();
3666             }
3667             else
3668             {
3669                 return list.size();
3670             }
3671         }
3672     }
3673 }