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