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