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
29
30
31
32 public class PluginWrapper
33 {
34 private String groupId;
35
36 private String artifactId;
37
38 private String version;
39
40 private String source;
41
42 public static List<PluginWrapper> addAll( List<?> plugins, String source )
43 {
44 List<PluginWrapper> results = null;
45
46 if ( !plugins.isEmpty() )
47 {
48 results = new ArrayList<PluginWrapper>( plugins.size() );
49 for ( Object o : plugins )
50 {
51 if ( o instanceof Plugin )
52 {
53 results.add( new PluginWrapper( (Plugin) o, source ) );
54 }
55 else
56 {
57 if ( o instanceof ReportPlugin )
58 {
59 results.add( new PluginWrapper( (ReportPlugin) o, source ) );
60 }
61 }
62
63 }
64 }
65 return results;
66 }
67
68 public PluginWrapper( Plugin plugin, String source )
69 {
70 setGroupId( plugin.getGroupId() );
71 setArtifactId( plugin.getArtifactId() );
72 setVersion( plugin.getVersion() );
73 setSource( source );
74 }
75
76 public PluginWrapper( ReportPlugin plugin, String source )
77 {
78 setGroupId( plugin.getGroupId() );
79 setArtifactId( plugin.getArtifactId() );
80 setVersion( plugin.getVersion() );
81 setSource( source );
82 }
83
84 public String getGroupId()
85 {
86 return groupId;
87 }
88
89 public void setGroupId( String groupId )
90 {
91 this.groupId = groupId;
92 }
93
94 public String getArtifactId()
95 {
96 return artifactId;
97 }
98
99 public void setArtifactId( String artifactId )
100 {
101 this.artifactId = artifactId;
102 }
103
104 public String getVersion()
105 {
106 return version;
107 }
108
109 public void setVersion( String version )
110 {
111 this.version = version;
112 }
113
114 public String getSource()
115 {
116 return source;
117 }
118
119 public void setSource( String source )
120 {
121 this.source = source;
122 }
123 }