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