1
2
3
4
5 package org.apache.maven.settings;
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.settings.Activation.newInstance() );
27 }
28
29 public Activation( org.apache.maven.api.settings.Activation delegate )
30 {
31 this( delegate, null );
32 }
33
34 public Activation( org.apache.maven.api.settings.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.settings.Activation getDelegate()
45 {
46 return ( org.apache.maven.api.settings.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 protected boolean replace( Object oldDelegate, Object newDelegate )
139 {
140 if ( super.replace( oldDelegate, newDelegate ) )
141 {
142 return true;
143 }
144 if ( oldDelegate == getDelegate().getOs() )
145 {
146 update( getDelegate().withOs( ( org.apache.maven.api.settings.ActivationOS ) newDelegate ) );
147 return true;
148 }
149 if ( oldDelegate == getDelegate().getProperty() )
150 {
151 update( getDelegate().withProperty( ( org.apache.maven.api.settings.ActivationProperty ) newDelegate ) );
152 return true;
153 }
154 if ( oldDelegate == getDelegate().getFile() )
155 {
156 update( getDelegate().withFile( ( org.apache.maven.api.settings.ActivationFile ) newDelegate ) );
157 return true;
158 }
159 return false;
160 }
161
162 public static List<org.apache.maven.api.settings.Activation> activationToApiV4( List<Activation> list )
163 {
164 return list != null ? new WrapperList<>( list, Activation::getDelegate, Activation::new ) : null;
165 }
166
167 public static List<Activation> activationToApiV3( List<org.apache.maven.api.settings.Activation> list )
168 {
169 return list != null ? new WrapperList<>( list, Activation::new, Activation::getDelegate ) : null;
170 }
171
172 }