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.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
19 @Generated
20 public class Activation
21 extends BaseObject
22 {
23
24 public Activation()
25 {
26 this( org.apache.maven.api.model.Activation.newInstance() );
27 }
28
29 public Activation( org.apache.maven.api.model.Activation delegate )
30 {
31 this( delegate, null );
32 }
33
34 public Activation( org.apache.maven.api.model.Activation delegate, BaseObject parent )
35 {
36 super( delegate, parent );
37 }
38
39 public Activation clone()
40 {
41 return new Activation( getDelegate() );
42 }
43
44 public org.apache.maven.api.model.Activation getDelegate()
45 {
46 return ( org.apache.maven.api.model.Activation ) super.getDelegate();
47 }
48
49 @Override
50 public boolean equals( Object o )
51 {
52 if ( this == o )
53 {
54 return true;
55 }
56 if ( o == null || !( o instanceof Activation ) )
57 {
58 return false;
59 }
60 Activation that = ( Activation ) o;
61 return Objects.equals( this.delegate, that.delegate );
62 }
63
64 @Override
65 public int hashCode()
66 {
67 return getDelegate().hashCode();
68 }
69
70 public boolean isActiveByDefault()
71 {
72 return getDelegate().isActiveByDefault();
73 }
74
75 public void setActiveByDefault( boolean activeByDefault )
76 {
77 if ( !Objects.equals( activeByDefault, getDelegate().isActiveByDefault() ) )
78 {
79 update( getDelegate().withActiveByDefault( activeByDefault ) );
80 }
81 }
82
83 public String getJdk()
84 {
85 return getDelegate().getJdk();
86 }
87
88 public void setJdk( String jdk )
89 {
90 if ( !Objects.equals( jdk, getDelegate().getJdk() ) )
91 {
92 update( getDelegate().withJdk( jdk ) );
93 }
94 }
95
96 public ActivationOS getOs()
97 {
98 return getDelegate().getOs() != null ? new ActivationOS( getDelegate().getOs(), this ) : null;
99 }
100
101 public void setOs( ActivationOS os )
102 {
103 if ( !Objects.equals( os, getDelegate().getOs() ) )
104 {
105 update( getDelegate().withOs( os.getDelegate() ) );
106 os.childrenTracking = this::replace;
107 }
108 }
109
110 public ActivationProperty getProperty()
111 {
112 return getDelegate().getProperty() != null ? new ActivationProperty( getDelegate().getProperty(), this ) : null;
113 }
114
115 public void setProperty( ActivationProperty property )
116 {
117 if ( !Objects.equals( property, getDelegate().getProperty() ) )
118 {
119 update( getDelegate().withProperty( property.getDelegate() ) );
120 property.childrenTracking = this::replace;
121 }
122 }
123
124 public ActivationFile getFile()
125 {
126 return getDelegate().getFile() != null ? new ActivationFile( getDelegate().getFile(), this ) : null;
127 }
128
129 public void setFile( ActivationFile file )
130 {
131 if ( !Objects.equals( file, getDelegate().getFile() ) )
132 {
133 update( getDelegate().withFile( file.getDelegate() ) );
134 file.childrenTracking = this::replace;
135 }
136 }
137
138 public InputLocation getLocation( Object key )
139 {
140 org.apache.maven.api.model.InputLocation loc = getDelegate().getLocation( key );
141 return loc != null ? new InputLocation( loc ) : null;
142 }
143
144 public void setLocation( Object key, InputLocation location )
145 {
146 update( org.apache.maven.api.model.Activation.newBuilder( getDelegate(), true )
147 .location( key, location.toApiLocation() ).build() );
148 }
149
150 protected boolean replace( Object oldDelegate, Object newDelegate )
151 {
152 if ( super.replace( oldDelegate, newDelegate ) )
153 {
154 return true;
155 }
156 if ( oldDelegate == getDelegate().getOs() )
157 {
158 update( getDelegate().withOs( ( org.apache.maven.api.model.ActivationOS ) newDelegate ) );
159 return true;
160 }
161 if ( oldDelegate == getDelegate().getProperty() )
162 {
163 update( getDelegate().withProperty( ( org.apache.maven.api.model.ActivationProperty ) newDelegate ) );
164 return true;
165 }
166 if ( oldDelegate == getDelegate().getFile() )
167 {
168 update( getDelegate().withFile( ( org.apache.maven.api.model.ActivationFile ) newDelegate ) );
169 return true;
170 }
171 return false;
172 }
173
174 public static List<org.apache.maven.api.model.Activation> activationToApiV4( List<Activation> list )
175 {
176 return list != null ? new WrapperList<>( list, Activation::getDelegate, Activation::new ) : null;
177 }
178
179 public static List<Activation> activationToApiV3( List<org.apache.maven.api.model.Activation> list )
180 {
181 return list != null ? new WrapperList<>( list, Activation::new, Activation::getDelegate ) : null;
182 }
183
184 }