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