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