Skip to content

Commit b61f86f

Browse files
committed
Thinking that this SDK will be used in projects with Native Image technology, was removed lombok dependency to avoid potential inconsistency that it may causes.
1 parent 6ce5279 commit b61f86f

File tree

3 files changed

+135
-41
lines changed

3 files changed

+135
-41
lines changed

pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,13 @@
1414
<project.encoding>UTF-8</project.encoding>
1515
<caffeine.version>3.1.8</caffeine.version>
1616
<junit.version>4.13.2</junit.version>
17-
<lombok.version>1.18.26</lombok.version>
1817
<mysql-connector.version>8.0.33</mysql-connector.version>
1918
<okhttp.version>4.10.0</okhttp.version>
2019
<protobuf.version>3.22.2</protobuf.version>
2120
<testcontainers.version>1.17.6</testcontainers.version>
2221
</properties>
2322

2423
<dependencies>
25-
<dependency>
26-
<groupId>org.projectlombok</groupId>
27-
<artifactId>lombok</artifactId>
28-
<version>${lombok.version}</version>
29-
</dependency>
30-
3124
<dependency>
3225
<groupId>org.slf4j</groupId>
3326
<artifactId>slf4j-api</artifactId>
Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
package io.eigr.spawn.api;
22

3-
import lombok.AllArgsConstructor;
4-
import lombok.Builder;
5-
import lombok.Getter;
6-
import lombok.NoArgsConstructor;
7-
83
import java.time.Duration;
94
import java.time.LocalDateTime;
105
import java.time.temporal.ChronoUnit;
116
import java.util.Optional;
127

13-
@Builder
14-
@Getter
15-
@AllArgsConstructor
16-
@NoArgsConstructor
178
public class InvocationOpts {
189

19-
@Builder.Default
20-
private boolean async = false;
10+
private final boolean async;
11+
private final Duration timeoutSeconds;
12+
private final Optional<Long> delaySeconds;
13+
private final Optional<LocalDateTime> scheduledTo;
14+
15+
private InvocationOpts(InvocationOptsBuilder invocationOptsBuilder) {
16+
this.async = invocationOptsBuilder.async;
17+
this.timeoutSeconds = invocationOptsBuilder.timeoutSeconds;
18+
this.delaySeconds = invocationOptsBuilder.delaySeconds;
19+
this.scheduledTo = invocationOptsBuilder.scheduledTo;
20+
}
21+
22+
public static InvocationOptsBuilder builder() {
23+
return new InvocationOptsBuilder();
24+
}
25+
26+
public boolean isAsync() {
27+
return async;
28+
}
2129

22-
@Builder.Default
23-
private Duration timeoutSeconds = Duration.ofSeconds(10);
30+
public Duration getTimeoutSeconds() {
31+
return timeoutSeconds;
32+
}
2433

25-
@Builder.Default
26-
private Optional<Long> delaySeconds = Optional.empty();
34+
public Optional<Long> getDelaySeconds() {
35+
return delaySeconds;
36+
}
2737

28-
@Builder.Default
29-
private Optional<LocalDateTime> scheduledTo = Optional.empty();
38+
public Optional<LocalDateTime> getScheduledTo() {
39+
return scheduledTo;
40+
}
3041

3142
public long getScheduleTimeInLong() {
3243
if (scheduledTo.isPresent()) {
@@ -40,4 +51,36 @@ public long getScheduleTimeInLong() {
4051
public long getTimeout() {
4152
return this.timeoutSeconds.toMillis();
4253
}
54+
55+
public static final class InvocationOptsBuilder {
56+
57+
private boolean async = false;
58+
private Duration timeoutSeconds = Duration.ofSeconds(10);
59+
private Optional<Long> delaySeconds = Optional.empty();
60+
private Optional<LocalDateTime> scheduledTo = Optional.empty();
61+
62+
public InvocationOpts build() {
63+
return new InvocationOpts(this);
64+
}
65+
66+
public InvocationOptsBuilder async(boolean async) {
67+
this.async = async;
68+
return this;
69+
}
70+
71+
public InvocationOptsBuilder timeoutSeconds(Duration timeoutSeconds) {
72+
this.timeoutSeconds = timeoutSeconds;
73+
return this;
74+
}
75+
76+
public InvocationOptsBuilder delaySeconds(Optional<Long> delaySeconds) {
77+
this.delaySeconds = delaySeconds;
78+
return this;
79+
}
80+
81+
public InvocationOptsBuilder scheduledTo(Optional<LocalDateTime> scheduledTo) {
82+
this.scheduledTo = scheduledTo;
83+
return this;
84+
}
85+
}
4386
}
Lines changed: 75 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,83 @@
11
package io.eigr.spawn.api;
22

3-
import lombok.*;
4-
53
import java.util.concurrent.Executor;
64
import java.util.concurrent.Executors;
75

8-
@Getter
9-
@Builder
10-
@NoArgsConstructor
11-
@AllArgsConstructor
12-
@ToString
136
public class TransportOpts {
147

15-
@Builder.Default
16-
private String host = "127.0.0.1";
17-
@Builder.Default
18-
private int port = 8091;
19-
@Builder.Default
20-
private String proxyHost = "127.0.0.1";
21-
@Builder.Default
22-
private int proxyPort = 9001;
23-
@Builder.Default
24-
private Executor executor = Executors.newCachedThreadPool();
8+
private String host;
9+
private int port;
10+
private String proxyHost;
11+
private int proxyPort;
12+
private Executor executor;
13+
14+
private TransportOpts(TransportOptsBuilder builder) {
15+
this.host = builder.host;
16+
this.port = builder.port;
17+
this.proxyHost = builder.proxyHost;
18+
this.proxyPort = builder.proxyPort;
19+
this.executor = builder.executor;
20+
}
21+
22+
public static TransportOptsBuilder builder() {
23+
return new TransportOptsBuilder();
24+
}
25+
26+
public String getHost() {
27+
return host;
28+
}
29+
30+
public int getPort() {
31+
return port;
32+
}
33+
34+
public String getProxyHost() {
35+
return proxyHost;
36+
}
37+
38+
public int getProxyPort() {
39+
return proxyPort;
40+
}
41+
42+
public Executor getExecutor() {
43+
return executor;
44+
}
45+
46+
public static final class TransportOptsBuilder {
47+
48+
private String host = "127.0.0.1";
49+
private int port = 8091;
50+
private String proxyHost = "127.0.0.1";
51+
private int proxyPort = 9001;
52+
private Executor executor = Executors.newCachedThreadPool();
53+
54+
public TransportOpts build() {
55+
return new TransportOpts(this);
56+
}
57+
58+
public TransportOptsBuilder host(String host) {
59+
this.host = host;
60+
return this;
61+
}
62+
63+
public TransportOptsBuilder port(int port) {
64+
this.port = port;
65+
return this;
66+
}
67+
68+
public TransportOptsBuilder proxyHost(String proxyHost) {
69+
this.proxyHost = proxyHost;
70+
return this;
71+
}
72+
73+
public TransportOptsBuilder proxyPort(int proxyPort) {
74+
this.proxyPort = proxyPort;
75+
return this;
76+
}
77+
78+
public TransportOptsBuilder executor(Executor executor) {
79+
this.executor = executor;
80+
return this;
81+
}
82+
}
2583
}

0 commit comments

Comments
 (0)