View Javadoc
1   // =================== DO NOT EDIT THIS FILE ====================
2   //  Generated by Modello Velocity from model-v3.vm
3   //  template, any modifications will be overwritten.
4   // ==============================================================
5   package org.apache.maven.model;
6   
7   import java.io.Serializable;
8   import java.util.AbstractList;
9   import java.util.ArrayList;
10  import java.util.Collections;
11  import java.util.HashMap;
12  import java.util.List;
13  import java.util.Map;
14  import java.util.Objects;
15  import java.util.stream.Collectors;
16  import java.util.stream.Stream;
17  import org.apache.maven.api.annotations.Generated;
18  import org.apache.maven.api.annotations.Nonnull;
19  import org.codehaus.plexus.util.xml.Xpp3Dom;
20  
21  @Generated
22  public class PluginExecution
23      extends ConfigurationContainer
24      implements Serializable, Cloneable
25  {
26  
27      public PluginExecution() {
28          this(org.apache.maven.api.model.PluginExecution.newInstance());
29      }
30  
31      public PluginExecution(org.apache.maven.api.model.PluginExecution delegate) {
32          this(delegate, null);
33      }
34  
35      public PluginExecution(org.apache.maven.api.model.PluginExecution delegate, BaseObject parent) {
36          super(delegate, parent);
37      }
38  
39      public PluginExecution clone(){
40          return new PluginExecution(getDelegate());
41      }
42  
43      @Override
44      public org.apache.maven.api.model.PluginExecution getDelegate() {
45          return (org.apache.maven.api.model.PluginExecution) super.getDelegate();
46      }
47  
48      @Override
49      public boolean equals(Object o) {
50          if (this == o) {
51              return true;
52          }
53          if (o == null || !(o instanceof PluginExecution)) {
54              return false;
55          }
56          PluginExecution that = (PluginExecution) o;
57          return Objects.equals(this.delegate, that.delegate);
58      }
59  
60      @Override
61      public int hashCode() {
62          return getDelegate().hashCode();
63      }
64  
65      public String getId() {
66          return getDelegate().getId();
67      }
68  
69      public void setId(String id) {
70          if (!Objects.equals(id, getId())) {
71              update(getDelegate().withId(id));
72          }
73      }
74  
75      public String getPhase() {
76          return getDelegate().getPhase();
77      }
78  
79      public void setPhase(String phase) {
80          if (!Objects.equals(phase, getPhase())) {
81              update(getDelegate().withPhase(phase));
82          }
83      }
84  
85      public int getPriority() {
86          return getDelegate().getPriority();
87      }
88  
89      public void setPriority(int priority) {
90          if (!Objects.equals(priority, getPriority())) {
91              update(getDelegate().withPriority(priority));
92          }
93      }
94  
95      @Nonnull
96      public List<String> getGoals() {
97          return new WrapperList<String, String>(() -> getDelegate().getGoals(), this::setGoals, s -> s, s -> s);
98      }
99  
100     public void setGoals(List<String> goals) {
101         if (!Objects.equals(goals, getGoals())) {
102             update(getDelegate().withGoals(goals));
103         }
104     }
105 
106     public void addGoal(String goal) {
107         update(getDelegate().withGoals(
108                Stream.concat(getDelegate().getGoals().stream(), Stream.of(goal))
109                         .collect(Collectors.toList())));
110     }
111 
112     public void removeGoal(String goal) {
113         update(getDelegate().withGoals(
114                getDelegate().getGoals().stream()
115                         .filter(e -> !Objects.equals(e, goal))
116                         .collect(Collectors.toList())));
117     }
118 
119     public InputLocation getLocation(Object key) {
120         org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation(key);
121         return loc != null ? new InputLocation(loc) : null;
122     }
123 
124     public void setLocation(Object key, InputLocation location) {
125         update(org.apache.maven.api.model.PluginExecution.newBuilder(getDelegate(), true)
126                         .location(key, location.toApiLocation()).build());
127     }
128 
129     protected boolean replace(Object oldDelegate, Object newDelegate) {
130         if (super.replace(oldDelegate, newDelegate)) {
131             return true;
132         }
133         return false;
134     }
135 
136     public static List<org.apache.maven.api.model.PluginExecution> pluginExecutionToApiV4(List<PluginExecution> list) {
137         return list != null ? new WrapperList<>(list, PluginExecution::getDelegate, PluginExecution::new) : null;
138     }
139 
140     public static List<PluginExecution> pluginExecutionToApiV3(List<org.apache.maven.api.model.PluginExecution> list) {
141         return list != null ? new WrapperList<>(list, PluginExecution::new, PluginExecution::getDelegate) : null;
142     }
143 
144 
145             
146     public static final String DEFAULT_EXECUTION_ID = "default";
147 
148     @Override
149     public String toString()
150     {
151         return getId();
152     }
153             
154           
155 }