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 import org.codehaus.plexus.util.xml.Xpp3Dom;
19
20 @Generated
21 public class Server
22 extends IdentifiableBase
23 implements Serializable, Cloneable
24 {
25
26 public Server()
27 {
28 this( org.apache.maven.api.settings.Server.newInstance() );
29 }
30
31 public Server( org.apache.maven.api.settings.Server delegate )
32 {
33 this( delegate, null );
34 }
35
36 public Server( org.apache.maven.api.settings.Server delegate, BaseObject parent )
37 {
38 super( delegate, parent );
39 }
40
41 public Server clone()
42 {
43 return new Server( getDelegate() );
44 }
45
46 @Override
47 public org.apache.maven.api.settings.Server getDelegate()
48 {
49 return ( org.apache.maven.api.settings.Server ) super.getDelegate();
50 }
51
52 @Override
53 public boolean equals( Object o )
54 {
55 if ( this == o )
56 {
57 return true;
58 }
59 if ( o == null || !( o instanceof Server ) )
60 {
61 return false;
62 }
63 Server that = ( Server ) o;
64 return Objects.equals( this.delegate, that.delegate );
65 }
66
67 @Override
68 public int hashCode()
69 {
70 return getDelegate().hashCode();
71 }
72
73 public String getUsername()
74 {
75 return getDelegate().getUsername();
76 }
77
78 public void setUsername( String username )
79 {
80 if ( !Objects.equals( username, getDelegate().getUsername() ) )
81 {
82 update( getDelegate().withUsername( username ) );
83 }
84 }
85
86 public String getPassword()
87 {
88 return getDelegate().getPassword();
89 }
90
91 public void setPassword( String password )
92 {
93 if ( !Objects.equals( password, getDelegate().getPassword() ) )
94 {
95 update( getDelegate().withPassword( password ) );
96 }
97 }
98
99 public String getPrivateKey()
100 {
101 return getDelegate().getPrivateKey();
102 }
103
104 public void setPrivateKey( String privateKey )
105 {
106 if ( !Objects.equals( privateKey, getDelegate().getPrivateKey() ) )
107 {
108 update( getDelegate().withPrivateKey( privateKey ) );
109 }
110 }
111
112 public String getPassphrase()
113 {
114 return getDelegate().getPassphrase();
115 }
116
117 public void setPassphrase( String passphrase )
118 {
119 if ( !Objects.equals( passphrase, getDelegate().getPassphrase() ) )
120 {
121 update( getDelegate().withPassphrase( passphrase ) );
122 }
123 }
124
125 public String getFilePermissions()
126 {
127 return getDelegate().getFilePermissions();
128 }
129
130 public void setFilePermissions( String filePermissions )
131 {
132 if ( !Objects.equals( filePermissions, getDelegate().getFilePermissions() ) )
133 {
134 update( getDelegate().withFilePermissions( filePermissions ) );
135 }
136 }
137
138 public String getDirectoryPermissions()
139 {
140 return getDelegate().getDirectoryPermissions();
141 }
142
143 public void setDirectoryPermissions( String directoryPermissions )
144 {
145 if ( !Objects.equals( directoryPermissions, getDelegate().getDirectoryPermissions() ) )
146 {
147 update( getDelegate().withDirectoryPermissions( directoryPermissions ) );
148 }
149 }
150
151 public Object getConfiguration()
152 {
153 return getDelegate().getConfiguration() != null ? new Xpp3Dom( getDelegate().getConfiguration(), this::replace ) : null;
154 }
155
156 public void setConfiguration( Object configuration )
157 {
158 if ( ! Objects.equals( ( ( Xpp3Dom ) configuration ).getDom(), getDelegate().getConfiguration() ) )
159 {
160 update( getDelegate().withConfiguration( ( ( Xpp3Dom ) configuration ).getDom() ) );
161 ( ( Xpp3Dom ) configuration ).setChildrenTracking( this::replace );
162 }
163 }
164
165 protected boolean replace( Object oldDelegate, Object newDelegate )
166 {
167 if ( super.replace( oldDelegate, newDelegate ) )
168 {
169 return true;
170 }
171 if ( getDelegate().getConfiguration() == oldDelegate )
172 {
173 update( getDelegate().withConfiguration( ( org.apache.maven.api.xml.XmlNode ) newDelegate ) );
174 }
175 return false;
176 }
177
178 public static List<org.apache.maven.api.settings.Server> serverToApiV4( List<Server> list )
179 {
180 return list != null ? new WrapperList<>( list, Server::getDelegate, Server::new ) : null;
181 }
182
183 public static List<Server> serverToApiV3( List<org.apache.maven.api.settings.Server> list )
184 {
185 return list != null ? new WrapperList<>( list, Server::new, Server::getDelegate ) : null;
186 }
187
188 }