1 package org.apache.maven.tools.plugin.annotations.datamodel;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugins.annotations.InstantiationStrategy;
23 import org.apache.maven.plugins.annotations.InstanciationStrategy;
24 import org.apache.maven.plugins.annotations.LifecyclePhase;
25 import org.apache.maven.plugins.annotations.Mojo;
26 import org.apache.maven.plugins.annotations.ResolutionScope;
27
28 import java.lang.annotation.Annotation;
29
30
31
32
33
34 @SuppressWarnings("deprecation")
35 public class MojoAnnotationContent
36 extends AnnotatedContent
37 implements Mojo
38 {
39 private String name;
40
41 private LifecyclePhase defaultPhase = LifecyclePhase.NONE;
42
43 private ResolutionScope requiresDependencyResolution = ResolutionScope.NONE;
44
45 private ResolutionScope requiresDependencyCollection = ResolutionScope.NONE;
46
47 private InstantiationStrategy instantiationStrategy = InstantiationStrategy.PER_LOOKUP;
48
49 private String executionStrategy = "once-per-session";
50
51 private boolean requiresProject = true;
52
53 private boolean requiresReports = false;
54
55 private boolean aggregator = false;
56
57 private boolean requiresDirectInvocation = false;
58
59 private boolean requiresOnline = false;
60
61 private boolean inheritByDefault = true;
62
63 private String configurator;
64
65 private boolean threadSafe = false;
66
67 public Class<? extends Annotation> annotationType()
68 {
69 return null;
70 }
71
72 public LifecyclePhase defaultPhase()
73 {
74 return defaultPhase;
75 }
76
77 public void defaultPhase( String phase )
78 {
79 this.defaultPhase = LifecyclePhase.valueOf( phase );
80 }
81
82 public ResolutionScope requiresDependencyResolution()
83 {
84 return requiresDependencyResolution;
85 }
86
87 public void requiresDependencyResolution( String requiresDependencyResolution )
88 {
89 this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
90 }
91
92 public ResolutionScope requiresDependencyCollection()
93 {
94 return requiresDependencyCollection;
95 }
96
97 public void requiresDependencyCollection( String requiresDependencyCollection )
98 {
99 this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
100 }
101
102 public InstantiationStrategy instantiationStrategy()
103 {
104 return instantiationStrategy;
105 }
106
107
108
109
110
111
112
113
114
115 @SuppressWarnings( "deprecation" )
116 public InstanciationStrategy instanciationStrategy()
117 {
118 if ( instantiationStrategy == null )
119 {
120 return null;
121 }
122 return InstanciationStrategy.valueOf( instanciationStrategy().name() );
123 }
124
125 public void instantiationStrategy( String instantiationStrategy )
126 {
127 this.instantiationStrategy = InstantiationStrategy.valueOf( instantiationStrategy );
128 }
129
130 public String executionStrategy()
131 {
132 return executionStrategy;
133 }
134
135 public void executionStrategy( String executionStrategy )
136 {
137 this.executionStrategy = executionStrategy;
138 }
139
140 public boolean requiresProject()
141 {
142 return requiresProject;
143 }
144
145 public void requiresProject( boolean requiresProject )
146 {
147 this.requiresProject = requiresProject;
148 }
149
150 public boolean requiresReports()
151 {
152 return requiresReports;
153 }
154
155 public void requiresReports( boolean requiresReports )
156 {
157 this.requiresReports = requiresReports;
158 }
159
160 public boolean aggregator()
161 {
162 return aggregator;
163 }
164
165 public void aggregator( boolean aggregator )
166 {
167 this.aggregator = aggregator;
168 }
169
170 public boolean requiresDirectInvocation()
171 {
172 return requiresDirectInvocation;
173 }
174
175 public void requiresDirectInvocation( boolean requiresDirectInvocation )
176 {
177 this.requiresDirectInvocation = requiresDirectInvocation;
178 }
179
180 public boolean requiresOnline()
181 {
182 return requiresOnline;
183 }
184
185 public void requiresOnline( boolean requiresOnline )
186 {
187 this.requiresOnline = requiresOnline;
188 }
189
190 public boolean inheritByDefault()
191 {
192 return inheritByDefault;
193 }
194
195 public void inheritByDefault( boolean inheritByDefault )
196 {
197 this.inheritByDefault = inheritByDefault;
198 }
199
200 public String configurator()
201 {
202 return configurator;
203 }
204
205 public void configurator( String configurator )
206 {
207 this.configurator = configurator;
208 }
209
210 public boolean threadSafe()
211 {
212 return threadSafe;
213 }
214
215 public void threadSafe( boolean threadSafe )
216 {
217 this.threadSafe = threadSafe;
218 }
219
220 public String name()
221 {
222 return this.name;
223 }
224
225 public void name( String name )
226 {
227 this.name = name;
228 }
229
230 @Override
231 public String toString()
232 {
233 final StringBuilder sb = new StringBuilder();
234 sb.append( "MojoAnnotationContent" );
235 sb.append( "{name='" ).append( name ).append( '\'' );
236 sb.append( ", defaultPhase=" ).append( defaultPhase );
237 sb.append( ", requiresDependencyResolution='" ).append( requiresDependencyResolution ).append( '\'' );
238 sb.append( ", requiresDependencyCollection='" ).append( requiresDependencyCollection ).append( '\'' );
239 sb.append( ", instantiationStrategy='" ).append( instantiationStrategy ).append( '\'' );
240 sb.append( ", executionStrategy='" ).append( executionStrategy ).append( '\'' );
241 sb.append( ", requiresProject=" ).append( requiresProject );
242 sb.append( ", requiresReports=" ).append( requiresReports );
243 sb.append( ", aggregator=" ).append( aggregator );
244 sb.append( ", requiresDirectInvocation=" ).append( requiresDirectInvocation );
245 sb.append( ", requiresOnline=" ).append( requiresOnline );
246 sb.append( ", inheritByDefault=" ).append( inheritByDefault );
247 sb.append( ", configurator='" ).append( configurator ).append( '\'' );
248 sb.append( ", threadSafe=" ).append( threadSafe );
249 sb.append( '}' );
250 return sb.toString();
251 }
252 }