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