001package org.apache.maven.tools.plugin.extractor.annotations.datamodel;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.maven.plugins.annotations.InstantiationStrategy;
023import org.apache.maven.plugins.annotations.LifecyclePhase;
024import org.apache.maven.plugins.annotations.Mojo;
025import org.apache.maven.plugins.annotations.ResolutionScope;
026
027import java.lang.annotation.Annotation;
028
029/**
030 * @author Olivier Lamy
031 * @since 3.0
032 */
033public class MojoAnnotationContent
034    extends AnnotatedContent
035    implements Mojo
036{
037    private String name;
038
039    private LifecyclePhase defaultPhase = LifecyclePhase.NONE;
040
041    private ResolutionScope requiresDependencyResolution = ResolutionScope.NONE;
042
043    private ResolutionScope requiresDependencyCollection = ResolutionScope.NONE;
044
045    private InstantiationStrategy instantiationStrategy = InstantiationStrategy.PER_LOOKUP;
046
047    private String executionStrategy = "once-per-session";
048
049    private boolean requiresProject = true;
050
051    private boolean requiresReports = false;
052
053    private boolean aggregator = false;
054
055    private boolean requiresDirectInvocation = false;
056
057    private boolean requiresOnline = false;
058
059    private boolean inheritByDefault = true;
060
061    private String configurator;
062
063    private boolean threadSafe = false;
064
065    @Override
066    public Class<? extends Annotation> annotationType()
067    {
068        return null;
069    }
070
071    @Override
072    public LifecyclePhase defaultPhase()
073    {
074        return defaultPhase;
075    }
076
077    public void defaultPhase( String phase )
078    {
079        this.defaultPhase = LifecyclePhase.valueOf( phase );
080    }
081
082    @Override
083    public ResolutionScope requiresDependencyResolution()
084    {
085        return requiresDependencyResolution;
086    }
087
088    public void requiresDependencyResolution( String requiresDependencyResolution )
089    {
090        this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
091    }
092
093    @Override
094    public ResolutionScope requiresDependencyCollection()
095    {
096        return requiresDependencyCollection;
097    }
098
099    public void requiresDependencyCollection( String requiresDependencyCollection )
100    {
101        this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
102    }
103
104    @Override
105    public InstantiationStrategy instantiationStrategy()
106    {
107        return instantiationStrategy;
108    }
109
110    public void instantiationStrategy( String instantiationStrategy )
111    {
112        this.instantiationStrategy = InstantiationStrategy.valueOf( instantiationStrategy );
113    }
114
115    @Override
116    public String executionStrategy()
117    {
118        return executionStrategy;
119    }
120
121    public void executionStrategy( String executionStrategy )
122    {
123        this.executionStrategy = executionStrategy;
124    }
125
126    @Override
127    public boolean requiresProject()
128    {
129        return requiresProject;
130    }
131
132    public void requiresProject( boolean requiresProject )
133    {
134        this.requiresProject = requiresProject;
135    }
136
137    @Override
138    public boolean requiresReports()
139    {
140        return requiresReports;
141    }
142
143    public void requiresReports( boolean requiresReports )
144    {
145        this.requiresReports = requiresReports;
146    }
147
148    @Override
149    public boolean aggregator()
150    {
151        return aggregator;
152    }
153
154    public void aggregator( boolean aggregator )
155    {
156        this.aggregator = aggregator;
157    }
158
159    @Override
160    public boolean requiresDirectInvocation()
161    {
162        return requiresDirectInvocation;
163    }
164
165    public void requiresDirectInvocation( boolean requiresDirectInvocation )
166    {
167        this.requiresDirectInvocation = requiresDirectInvocation;
168    }
169
170    @Override
171    public boolean requiresOnline()
172    {
173        return requiresOnline;
174    }
175
176    public void requiresOnline( boolean requiresOnline )
177    {
178        this.requiresOnline = requiresOnline;
179    }
180
181    @Override
182    public boolean inheritByDefault()
183    {
184        return inheritByDefault;
185    }
186
187    public void inheritByDefault( boolean inheritByDefault )
188    {
189        this.inheritByDefault = inheritByDefault;
190    }
191
192    @Override
193    public String configurator()
194    {
195        return configurator;
196    }
197
198    public void configurator( String configurator )
199    {
200        this.configurator = configurator;
201    }
202
203    @Override
204    public boolean threadSafe()
205    {
206        return threadSafe;
207    }
208
209    public void threadSafe( boolean threadSafe )
210    {
211        this.threadSafe = threadSafe;
212    }
213
214    @Override
215    public String name()
216    {
217        return this.name;
218    }
219
220    public void name( String name )
221    {
222        this.name = name;
223    }
224
225    @Override
226    public String toString()
227    {
228        final StringBuilder sb = new StringBuilder();
229        sb.append( "MojoAnnotationContent" );
230        sb.append( "{name='" ).append( name ).append( '\'' );
231        sb.append( ", defaultPhase=" ).append( defaultPhase );
232        sb.append( ", requiresDependencyResolution='" ).append( requiresDependencyResolution ).append( '\'' );
233        sb.append( ", requiresDependencyCollection='" ).append( requiresDependencyCollection ).append( '\'' );
234        sb.append( ", instantiationStrategy='" ).append( instantiationStrategy ).append( '\'' );
235        sb.append( ", executionStrategy='" ).append( executionStrategy ).append( '\'' );
236        sb.append( ", requiresProject=" ).append( requiresProject );
237        sb.append( ", requiresReports=" ).append( requiresReports );
238        sb.append( ", aggregator=" ).append( aggregator );
239        sb.append( ", requiresDirectInvocation=" ).append( requiresDirectInvocation );
240        sb.append( ", requiresOnline=" ).append( requiresOnline );
241        sb.append( ", inheritByDefault=" ).append( inheritByDefault );
242        sb.append( ", configurator='" ).append( configurator ).append( '\'' );
243        sb.append( ", threadSafe=" ).append( threadSafe );
244        sb.append( '}' );
245        return sb.toString();
246    }
247}