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    public Class<? extends Annotation> annotationType()
066    {
067        return null;
068    }
069
070    public LifecyclePhase defaultPhase()
071    {
072        return defaultPhase;
073    }
074
075    public void defaultPhase( String phase )
076    {
077        this.defaultPhase = LifecyclePhase.valueOf( phase );
078    }
079
080    public ResolutionScope requiresDependencyResolution()
081    {
082        return requiresDependencyResolution;
083    }
084
085    public void requiresDependencyResolution( String requiresDependencyResolution )
086    {
087        this.requiresDependencyResolution = ResolutionScope.valueOf( requiresDependencyResolution );
088    }
089
090    public ResolutionScope requiresDependencyCollection()
091    {
092        return requiresDependencyCollection;
093    }
094
095    public void requiresDependencyCollection( String requiresDependencyCollection )
096    {
097        this.requiresDependencyCollection = ResolutionScope.valueOf( requiresDependencyCollection );
098    }
099
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}