View Javadoc
1   package org.apache.maven.tools.plugin.extractor.annotations.datamodel;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.plugins.annotations.InstantiationStrategy;
23  import org.apache.maven.plugins.annotations.LifecyclePhase;
24  import org.apache.maven.plugins.annotations.Mojo;
25  import org.apache.maven.plugins.annotations.ResolutionScope;
26  
27  import java.lang.annotation.Annotation;
28  
29  /**
30   * @author Olivier Lamy
31   * @since 3.0
32   */
33  public class MojoAnnotationContent
34      extends AnnotatedContent
35      implements Mojo
36  {
37      private String name;
38  
39      private LifecyclePhase defaultPhase = LifecyclePhase.NONE;
40  
41      private ResolutionScope requiresDependencyResolution = ResolutionScope.NONE;
42  
43      private ResolutionScope requiresDependencyCollection = ResolutionScope.NONE;
44  
45      private InstantiationStrategy instantiationStrategy = InstantiationStrategy.PER_LOOKUP;
46  
47      private String executionStrategy = "once-per-session";
48  
49      private boolean requiresProject = true;
50  
51      private boolean requiresReports = false;
52  
53      private boolean aggregator = false;
54  
55      private boolean requiresDirectInvocation = false;
56  
57      private boolean requiresOnline = false;
58  
59      private boolean inheritByDefault = true;
60  
61      private String configurator;
62  
63      private boolean threadSafe = false;
64  
65      public Class<? extends Annotation> annotationType()
66      {
67          return null;
68      }
69  
70      public LifecyclePhase defaultPhase()
71      {
72          return defaultPhase;
73      }
74  
75      public void defaultPhase( String phase )
76      {
77          this.defaultPhase = LifecyclePhase.valueOf( phase );
78      }
79  
80      public ResolutionScope requiresDependencyResolution()
81      {
82          return requiresDependencyResolution;
83      }
84  
85      public void requiresDependencyResolution( String requiresDependencyResolution )
86      {
87          this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
88      }
89  
90      public ResolutionScope requiresDependencyCollection()
91      {
92          return requiresDependencyCollection;
93      }
94  
95      public void requiresDependencyCollection( String requiresDependencyCollection )
96      {
97          this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
98      }
99  
100     public InstantiationStrategy instantiationStrategy()
101     {
102         return instantiationStrategy;
103     }
104 
105     public void instantiationStrategy( String instantiationStrategy )
106     {
107         this.instantiationStrategy = InstantiationStrategy.valueOf( instantiationStrategy );
108     }
109 
110     public String executionStrategy()
111     {
112         return executionStrategy;
113     }
114 
115     public void executionStrategy( String executionStrategy )
116     {
117         this.executionStrategy = executionStrategy;
118     }
119 
120     public boolean requiresProject()
121     {
122         return requiresProject;
123     }
124 
125     public void requiresProject( boolean requiresProject )
126     {
127         this.requiresProject = requiresProject;
128     }
129 
130     public boolean requiresReports()
131     {
132         return requiresReports;
133     }
134 
135     public void requiresReports( boolean requiresReports )
136     {
137         this.requiresReports = requiresReports;
138     }
139 
140     public boolean aggregator()
141     {
142         return aggregator;
143     }
144 
145     public void aggregator( boolean aggregator )
146     {
147         this.aggregator = aggregator;
148     }
149 
150     public boolean requiresDirectInvocation()
151     {
152         return requiresDirectInvocation;
153     }
154 
155     public void requiresDirectInvocation( boolean requiresDirectInvocation )
156     {
157         this.requiresDirectInvocation = requiresDirectInvocation;
158     }
159 
160     public boolean requiresOnline()
161     {
162         return requiresOnline;
163     }
164 
165     public void requiresOnline( boolean requiresOnline )
166     {
167         this.requiresOnline = requiresOnline;
168     }
169 
170     public boolean inheritByDefault()
171     {
172         return inheritByDefault;
173     }
174 
175     public void inheritByDefault( boolean inheritByDefault )
176     {
177         this.inheritByDefault = inheritByDefault;
178     }
179 
180     public String configurator()
181     {
182         return configurator;
183     }
184 
185     public void configurator( String configurator )
186     {
187         this.configurator = configurator;
188     }
189 
190     public boolean threadSafe()
191     {
192         return threadSafe;
193     }
194 
195     public void threadSafe( boolean threadSafe )
196     {
197         this.threadSafe = threadSafe;
198     }
199 
200     public String name()
201     {
202         return this.name;
203     }
204 
205     public void name( String name )
206     {
207         this.name = name;
208     }
209 
210     @Override
211     public String toString()
212     {
213         final StringBuilder sb = new StringBuilder();
214         sb.append( "MojoAnnotationContent" );
215         sb.append( "{name='" ).append( name ).append( '\'' );
216         sb.append( ", defaultPhase=" ).append( defaultPhase );
217         sb.append( ", requiresDependencyResolution='" ).append( requiresDependencyResolution ).append( '\'' );
218         sb.append( ", requiresDependencyCollection='" ).append( requiresDependencyCollection ).append( '\'' );
219         sb.append( ", instantiationStrategy='" ).append( instantiationStrategy ).append( '\'' );
220         sb.append( ", executionStrategy='" ).append( executionStrategy ).append( '\'' );
221         sb.append( ", requiresProject=" ).append( requiresProject );
222         sb.append( ", requiresReports=" ).append( requiresReports );
223         sb.append( ", aggregator=" ).append( aggregator );
224         sb.append( ", requiresDirectInvocation=" ).append( requiresDirectInvocation );
225         sb.append( ", requiresOnline=" ).append( requiresOnline );
226         sb.append( ", inheritByDefault=" ).append( inheritByDefault );
227         sb.append( ", configurator='" ).append( configurator ).append( '\'' );
228         sb.append( ", threadSafe=" ).append( threadSafe );
229         sb.append( '}' );
230         return sb.toString();
231     }
232 }