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