1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.tools.plugin.extractor.annotations.scanner;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 import org.apache.maven.artifact.Artifact;
25 import org.apache.maven.tools.plugin.extractor.annotations.datamodel.ComponentAnnotationContent;
26 import org.apache.maven.tools.plugin.extractor.annotations.datamodel.ExecuteAnnotationContent;
27 import org.apache.maven.tools.plugin.extractor.annotations.datamodel.MojoAnnotationContent;
28 import org.apache.maven.tools.plugin.extractor.annotations.datamodel.ParameterAnnotationContent;
29
30
31
32
33
34 public class MojoAnnotatedClass {
35 private String className;
36
37 private int classVersion;
38
39 private String parentClassName;
40
41 private MojoAnnotationContent mojo;
42
43 private ExecuteAnnotationContent execute;
44
45
46
47
48 private Map<String, ParameterAnnotationContent> parameters;
49
50
51
52
53 private Map<String, ComponentAnnotationContent> components;
54
55
56
57
58 private Artifact artifact;
59
60 private boolean v4Api;
61
62 public MojoAnnotatedClass() {
63
64 }
65
66 public String getClassName() {
67 return className;
68 }
69
70 public MojoAnnotatedClass setClassName(String className) {
71 this.className = className;
72 return this;
73 }
74
75 public int getClassVersion() {
76 return classVersion;
77 }
78
79 public MojoAnnotatedClass setClassVersion(int classVersion) {
80 this.classVersion = classVersion;
81 return this;
82 }
83
84 public MojoAnnotationContent getMojo() {
85 return mojo;
86 }
87
88 public MojoAnnotatedClass setMojo(MojoAnnotationContent mojo) {
89 this.mojo = mojo;
90 return this;
91 }
92
93 public ExecuteAnnotationContent getExecute() {
94 return execute;
95 }
96
97 public MojoAnnotatedClass setExecute(ExecuteAnnotationContent execute) {
98 this.execute = execute;
99 return this;
100 }
101
102 public Map<String, ParameterAnnotationContent> getParameters() {
103 if (this.parameters == null) {
104 this.parameters = new HashMap<>();
105 }
106 return parameters;
107 }
108
109 public MojoAnnotatedClass setParameters(Map<String, ParameterAnnotationContent> parameters) {
110 this.parameters = parameters;
111 return this;
112 }
113
114 public Map<String, ComponentAnnotationContent> getComponents() {
115 if (this.components == null) {
116 this.components = new HashMap<>();
117 }
118 return components;
119 }
120
121 public MojoAnnotatedClass setComponents(Map<String, ComponentAnnotationContent> components) {
122 this.components = components;
123 return this;
124 }
125
126 public String getParentClassName() {
127 return parentClassName;
128 }
129
130 public MojoAnnotatedClass setParentClassName(String parentClassName) {
131 this.parentClassName = parentClassName;
132 return this;
133 }
134
135 public Artifact getArtifact() {
136 return artifact;
137 }
138
139 public void setArtifact(Artifact artifact) {
140 this.artifact = artifact;
141 }
142
143 public boolean hasAnnotations() {
144 return !(getComponents().isEmpty() && getParameters().isEmpty() && execute == null && mojo == null);
145 }
146
147 public boolean isV4Api() {
148 return v4Api;
149 }
150
151 public void setV4Api(boolean v4Api) {
152 this.v4Api = v4Api;
153 }
154
155 @Override
156 public String toString() {
157 final StringBuilder sb = new StringBuilder();
158 sb.append("MojoAnnotatedClass");
159 sb.append("{className='").append(className).append('\'');
160 sb.append(", classVersion=").append(classVersion);
161 sb.append(", parentClassName='").append(parentClassName).append('\'');
162 sb.append(", mojo=").append(mojo);
163 sb.append(", execute=").append(execute);
164 sb.append(", parameters=").append(parameters);
165 sb.append(", components=").append(components);
166 sb.append(", v4api=").append(v4Api);
167 sb.append('}');
168 return sb.toString();
169 }
170 }