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