Repository navigation
Expand file tree
/
Copy pathApiConfig.java
More file actions
74 lines (59 loc) · 1.57 KB
/
Copy pathApiConfig.java
File metadata and controls
74 lines (59 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package org.codebrewery;
public final class ApiConfig
{
private final String host;
private final String port;
private final String apiLocation;
private ApiConfig(final String host, final String port, final String apiLocation)
{
this.host = host;
this.port = port;
this.apiLocation = apiLocation;
}
public String getHost()
{
return this.host;
}
public String getPort()
{
return this.port;
}
public String getApiLocation()
{
return this.apiLocation;
}
public String getRequestBaseUrl() {
return getHost() + ":" + getPort() + "/" + getApiLocation();
}
public static class ConfigBuilder
{
private String nestedHost;
private String nestedPort;
private String nestedApiLocation;
public ConfigBuilder()
{
this.nestedHost = null;
this.nestedApiLocation = "api";
this.nestedPort = "8080";
}
public ConfigBuilder port(final String nestedPost)
{
this.nestedPort = nestedPost;
return this;
}
public ConfigBuilder apiLocation(final String apiLocation)
{
this.nestedApiLocation = apiLocation;
return this;
}
public ConfigBuilder host(final String nestedHost)
{
this.nestedHost = nestedHost;
return this;
}
public ApiConfig build()
{
return new ApiConfig(nestedHost, nestedPort, nestedApiLocation);
}
}
}