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.Properties;
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 Profile
23      extends ModelBase
24      implements Serializable, Cloneable
25  {
26  
27      public Profile()
28      {
29          this( org.apache.maven.api.model.Profile.newInstance() );
30      }
31  
32      public Profile( org.apache.maven.api.model.Profile delegate )
33      {
34          this( delegate, null );
35      }
36  
37      public Profile( org.apache.maven.api.model.Profile delegate, BaseObject parent )
38      {
39          super( delegate, parent );
40      }
41  
42      public Profile clone()
43      {
44          return new Profile( getDelegate() );
45      }
46  
47      @Override
48      public org.apache.maven.api.model.Profile getDelegate()
49      {
50          return ( org.apache.maven.api.model.Profile ) super.getDelegate();
51      }
52  
53      public String getId()
54      {
55          return getDelegate().getId();
56      }
57  
58      public void setId( String id )
59      {
60          if ( !Objects.equals( id, getDelegate().getId() ) )
61          {
62              update( getDelegate().withId( id ) );
63          }
64      }
65  
66      public Activation getActivation()
67      {
68          return getDelegate().getActivation() != null ? new Activation( getDelegate().getActivation(), this ) : null;
69      }
70  
71      public void setActivation( Activation activation )
72      {
73          if ( !Objects.equals( activation, getDelegate().getActivation() ) )
74          {
75              update( getDelegate().withActivation( activation.getDelegate() ) );
76              activation.childrenTracking = this::replace;
77          }
78      }
79  
80      public BuildBase getBuild()
81      {
82          return getDelegate().getBuild() != null ? new BuildBase( getDelegate().getBuild(), this ) : null;
83      }
84  
85      public void setBuild( BuildBase build )
86      {
87          if ( !Objects.equals( build, getDelegate().getBuild() ) )
88          {
89              update( getDelegate().withBuild( build.getDelegate() ) );
90              build.childrenTracking = this::replace;
91          }
92      }
93  
94      public InputLocation getLocation( Object key )
95      {
96          org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
97          return loc != null ? new InputLocation( loc ) : null;
98      }
99  
100     public void setLocation( Object key, InputLocation location )
101     {
102         update( org.apache.maven.api.model.Profile.newBuilder( getDelegate(), true )
103                         .location( key, location.toApiLocation() ).build() );
104     }
105 
106     protected boolean replace( Object oldDelegate, Object newDelegate )
107     {
108         if ( super.replace( oldDelegate, newDelegate ) )
109         {
110             return true;
111         }
112         if ( oldDelegate == getDelegate().getActivation() )
113         {
114             update( getDelegate().withActivation( ( org.apache.maven.api.model.Activation ) newDelegate ) );
115             return true;
116         }
117         if ( oldDelegate == getDelegate().getBuild() )
118         {
119             update( getDelegate().withBuild( ( org.apache.maven.api.model.BuildBase ) newDelegate ) );
120             return true;
121         }
122         return false;
123     }
124 
125     public static List<org.apache.maven.api.model.Profile> profileToApiV4( List<Profile> list )
126     {
127         return list != null ? new WrapperList<>( list, Profile::getDelegate, Profile::new ) : null;
128     }
129 
130     public static List<Profile> profileToApiV3( List<org.apache.maven.api.model.Profile> list )
131     {
132         return list != null ? new WrapperList<>( list, Profile::new, Profile::getDelegate ) : null;
133     }
134 
135 
136             
137     public static final String SOURCE_POM = "pom";
138 
139     public static final String SOURCE_SETTINGS = "settings.xml";
140 
141     public void setSource( String source )
142     {
143         getDelegate().setSource( source );
144     }
145 
146     public String getSource()
147     {
148         return getDelegate().getSource();
149     }
150 
151     /**
152      * @see java.lang.Object#toString()
153      */
154     public String toString()
155     {
156         return "Profile {id: " + getId() + ", source: " + getSource() + "}";
157     }
158             
159           
160 }