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.datamodel;
20
21 import java.lang.annotation.Annotation;
22 import java.util.Objects;
23
24 import org.apache.maven.plugins.annotations.Execute;
25 import org.apache.maven.plugins.annotations.LifecyclePhase;
26
27
28
29
30
31 public class ExecuteAnnotationContent implements Execute {
32 private String goal;
33
34 private String lifecycle;
35
36 private LifecyclePhase phase;
37
38 private String customPhase;
39
40 @Override
41 public LifecyclePhase phase() {
42 return this.phase;
43 }
44
45 @Override
46 public String customPhase() {
47 return customPhase;
48 }
49
50 @Override
51 public String goal() {
52 return this.goal;
53 }
54
55 @Override
56 public String lifecycle() {
57 return this.lifecycle;
58 }
59
60 public void phase(String phase) {
61 if (phase != null && !phase.isEmpty()) {
62 for (LifecyclePhase p : LifecyclePhase.values()) {
63 if (Objects.equals(phase, p.id()) || Objects.equals(phase, p.name())) {
64 this.phase = p;
65 this.customPhase = null;
66 return;
67 }
68 }
69 this.phase = null;
70 this.customPhase = phase;
71 } else {
72 this.phase = null;
73 this.customPhase = null;
74 }
75 this.phase = LifecyclePhase.valueOf(phase);
76 }
77
78 public void customPhase(String customPhase) {
79 this.customPhase = customPhase;
80 }
81
82 public void goal(String goal) {
83 this.goal = goal;
84 }
85
86 public void lifecycle(String lifecycle) {
87 this.lifecycle = lifecycle;
88 }
89
90 @Override
91 public Class<? extends Annotation> annotationType() {
92 return null;
93 }
94
95 @Override
96 public String toString() {
97 final StringBuilder sb = new StringBuilder();
98 sb.append("ExecuteAnnotationContent");
99 sb.append("{goal='").append(goal).append('\'');
100 sb.append(", lifecycle='").append(lifecycle).append('\'');
101 sb.append(", phase=").append(phase);
102 sb.append(", customPhase=").append(customPhase);
103 sb.append('}');
104 return sb.toString();
105 }
106 }