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 Proxy
21 extends IdentifiableBase
22 implements Serializable, Cloneable
23 {
24
25 public Proxy() {
26 this(org.apache.maven.api.settings.Proxy.newInstance());
27 }
28
29 public Proxy(org.apache.maven.api.settings.Proxy delegate) {
30 this(delegate, null);
31 }
32
33 public Proxy(org.apache.maven.api.settings.Proxy delegate, BaseObject parent) {
34 super(delegate, parent);
35 }
36
37 public Proxy clone(){
38 return new Proxy(getDelegate());
39 }
40
41 @Override
42 public org.apache.maven.api.settings.Proxy getDelegate() {
43 return (org.apache.maven.api.settings.Proxy) super.getDelegate();
44 }
45
46 @Override
47 public boolean equals(Object o) {
48 if (this == o) {
49 return true;
50 }
51 if (o == null || !(o instanceof Proxy)) {
52 return false;
53 }
54 Proxy that = (Proxy) o;
55 return Objects.equals(this.delegate, that.delegate);
56 }
57
58 @Override
59 public int hashCode() {
60 return getDelegate().hashCode();
61 }
62
63 public String getActiveString() {
64 return getDelegate().getActiveString();
65 }
66
67 public void setActiveString(String activeString) {
68 if (!Objects.equals(activeString, getActiveString())) {
69 update(getDelegate().withActiveString(activeString));
70 }
71 }
72
73 public String getProtocol() {
74 return getDelegate().getProtocol();
75 }
76
77 public void setProtocol(String protocol) {
78 if (!Objects.equals(protocol, getProtocol())) {
79 update(getDelegate().withProtocol(protocol));
80 }
81 }
82
83 public String getUsername() {
84 return getDelegate().getUsername();
85 }
86
87 public void setUsername(String username) {
88 if (!Objects.equals(username, getUsername())) {
89 update(getDelegate().withUsername(username));
90 }
91 }
92
93 public String getPassword() {
94 return getDelegate().getPassword();
95 }
96
97 public void setPassword(String password) {
98 if (!Objects.equals(password, getPassword())) {
99 update(getDelegate().withPassword(password));
100 }
101 }
102
103 public String getPortString() {
104 return getDelegate().getPortString();
105 }
106
107 public void setPortString(String portString) {
108 if (!Objects.equals(portString, getPortString())) {
109 update(getDelegate().withPortString(portString));
110 }
111 }
112
113 public String getHost() {
114 return getDelegate().getHost();
115 }
116
117 public void setHost(String host) {
118 if (!Objects.equals(host, getHost())) {
119 update(getDelegate().withHost(host));
120 }
121 }
122
123 public String getNonProxyHosts() {
124 return getDelegate().getNonProxyHosts();
125 }
126
127 public void setNonProxyHosts(String nonProxyHosts) {
128 if (!Objects.equals(nonProxyHosts, getNonProxyHosts())) {
129 update(getDelegate().withNonProxyHosts(nonProxyHosts));
130 }
131 }
132
133 protected boolean replace(Object oldDelegate, Object newDelegate) {
134 if (super.replace(oldDelegate, newDelegate)) {
135 return true;
136 }
137 return false;
138 }
139
140 public static List<org.apache.maven.api.settings.Proxy> proxyToApiV4(List<Proxy> list) {
141 return list != null ? new WrapperList<>(list, Proxy::getDelegate, Proxy::new) : null;
142 }
143
144 public static List<Proxy> proxyToApiV3(List<org.apache.maven.api.settings.Proxy> list) {
145 return list != null ? new WrapperList<>(list, Proxy::new, Proxy::getDelegate) : null;
146 }
147
148
149 public boolean isActive() {
150 return (getActiveString() != null) ? Boolean.parseBoolean(getActiveString()) : true;
151 }
152
153 public void setActive(boolean active) {
154 setActiveString(String.valueOf(active));
155 }
156
157 public int getPort() {
158 return (getPortString() != null) ? Integer.parseInt(getPortString()) : 8080;
159 }
160
161 public void setPort(int port) {
162 setPortString(String.valueOf(port));
163 }
164
165 }