1 package org.apache.maven.plugins.enforcer.utils;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.apache.maven.model.Plugin;
26 import org.apache.maven.model.ReportPlugin;
27
28 public class PluginWrapper
29 {
30 private String groupId;
31
32 private String artifactId;
33
34 private String version;
35
36 private String source;
37
38 public static List<PluginWrapper> addAll( List<?> plugins, String source )
39 {
40 List<PluginWrapper> results = null;
41
42 if ( !plugins.isEmpty() )
43 {
44 results = new ArrayList<PluginWrapper>( plugins.size() );
45 for ( Object o : plugins )
46 {
47 if ( o instanceof Plugin )
48 {
49 results.add( new PluginWrapper( (Plugin) o, source ) );
50 }
51 else
52 {
53 if ( o instanceof ReportPlugin )
54 {
55 results.add( new PluginWrapper( (ReportPlugin) o, source ) );
56 }
57 }
58
59 }
60 }
61 return results;
62 }
63
64 public PluginWrapper( Plugin plugin, String source )
65 {
66 setGroupId( plugin.getGroupId() );
67 setArtifactId( plugin.getArtifactId() );
68 setVersion( plugin.getVersion() );
69 setSource( source );
70 }
71
72 public PluginWrapper( ReportPlugin plugin, String source )
73 {
74 setGroupId( plugin.getGroupId() );
75 setArtifactId( plugin.getArtifactId() );
76 setVersion( plugin.getVersion() );
77 setSource( source );
78 }
79
80 public String getGroupId()
81 {
82 return groupId;
83 }
84
85 public void setGroupId( String groupId )
86 {
87 this.groupId = groupId;
88 }
89
90 public String getArtifactId()
91 {
92 return artifactId;
93 }
94
95 public void setArtifactId( String artifactId )
96 {
97 this.artifactId = artifactId;
98 }
99
100 public String getVersion()
101 {
102 return version;
103 }
104
105 public void setVersion( String version )
106 {
107 this.version = version;
108 }
109
110 public String getSource()
111 {
112 return source;
113 }
114
115 public void setSource( String source )
116 {
117 this.source = source;
118 }
119 }