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