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