Skip to content

Commit d76e5fc

Browse files
author
gazbert
committed
#169 - Lombok + Intellisense cleanup
1 parent 6c5d394 commit d76e5fc

8 files changed

+27
-138
lines changed

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/exchange/AuthenticationConfigImpl.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
import com.gazbert.bxbot.exchange.api.AuthenticationConfig;
2727
import java.util.HashMap;
2828
import java.util.Map;
29+
import lombok.Setter;
2930

3031
/**
3132
* Exchange API Authentication config.
3233
*
3334
* @author gazbert
3435
*/
36+
@Setter
3537
public class AuthenticationConfigImpl implements AuthenticationConfig {
3638

3739
private Map<String, String> items;
@@ -54,13 +56,4 @@ public String getItem(String name) {
5456
Map<String, String> getItems() {
5557
return items;
5658
}
57-
58-
/**
59-
* Sets the config items.
60-
*
61-
* @param items the config items.
62-
*/
63-
public void setItems(Map<String, String> items) {
64-
this.items = items;
65-
}
6659
}

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/exchange/ExchangeConfigImpl.java

+7-40
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,23 @@
2727
import com.gazbert.bxbot.exchange.api.ExchangeConfig;
2828
import com.gazbert.bxbot.exchange.api.NetworkConfig;
2929
import com.gazbert.bxbot.exchange.api.OtherConfig;
30-
import com.google.common.base.MoreObjects;
30+
import lombok.Setter;
31+
import lombok.ToString;
3132

3233
/**
3334
* Exchange API Exchange config.
3435
*
3536
* @author gazbert
3637
*/
38+
@Setter
39+
@ToString
3740
public class ExchangeConfigImpl implements ExchangeConfig {
3841

3942
private String exchangeName;
4043
private String exchangeAdapter;
41-
private AuthenticationConfig authenticationConfig;
44+
45+
@ToString.Exclude private AuthenticationConfig authenticationConfig;
46+
4247
private NetworkConfig networkConfig;
4348
private OtherConfig otherConfig;
4449

@@ -80,24 +85,6 @@ public AuthenticationConfig getAuthenticationConfig() {
8085
return authenticationConfig;
8186
}
8287

83-
/**
84-
* Sets the authentication config.
85-
*
86-
* @param authenticationConfig authentication config.
87-
*/
88-
public void setAuthenticationConfig(AuthenticationConfig authenticationConfig) {
89-
this.authenticationConfig = authenticationConfig;
90-
}
91-
92-
/**
93-
* Sets the network config.
94-
*
95-
* @param networkConfig the network config.
96-
*/
97-
public void setNetworkConfig(NetworkConfig networkConfig) {
98-
this.networkConfig = networkConfig;
99-
}
100-
10188
@Override
10289
public NetworkConfig getNetworkConfig() {
10390
return networkConfig;
@@ -107,24 +94,4 @@ public NetworkConfig getNetworkConfig() {
10794
public OtherConfig getOtherConfig() {
10895
return otherConfig;
10996
}
110-
111-
/**
112-
* Sets the other config.
113-
*
114-
* @param otherConfig the other config.
115-
*/
116-
public void setOtherConfig(OtherConfig otherConfig) {
117-
this.otherConfig = otherConfig;
118-
}
119-
120-
@Override
121-
public String toString() {
122-
return MoreObjects.toStringHelper(this)
123-
.add("exchangeName", exchangeName)
124-
.add("exchangeAdapter", exchangeAdapter)
125-
.add("authenticationConfig", "NOT SHOWN BY DESIGN")
126-
.add("networkConfig", networkConfig)
127-
.add("otherConfig", otherConfig)
128-
.toString();
129-
}
13097
}

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/exchange/NetworkConfigImpl.java

+4-37
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
package com.gazbert.bxbot.core.config.exchange;
2525

2626
import com.gazbert.bxbot.exchange.api.NetworkConfig;
27-
import com.google.common.base.MoreObjects;
2827
import java.util.ArrayList;
2928
import java.util.List;
29+
import lombok.Setter;
30+
import lombok.ToString;
3031

3132
/**
3233
* Exchange API Network config.
3334
*
3435
* @author gazbert
3536
*/
37+
@Setter
38+
@ToString
3639
public class NetworkConfigImpl implements NetworkConfig {
3740

3841
private Integer connectionTimeout;
@@ -50,49 +53,13 @@ public Integer getConnectionTimeout() {
5053
return connectionTimeout;
5154
}
5255

53-
/**
54-
* Sets the connection timeout.
55-
*
56-
* @param connectionTimeout the connection timeout.
57-
*/
58-
public void setConnectionTimeout(Integer connectionTimeout) {
59-
this.connectionTimeout = connectionTimeout;
60-
}
61-
6256
@Override
6357
public List<Integer> getNonFatalErrorCodes() {
6458
return nonFatalErrorCodes;
6559
}
6660

67-
/**
68-
* Sets the non-fatal error codes.
69-
*
70-
* @param nonFatalErrorCodes the non fatal error codes.
71-
*/
72-
public void setNonFatalErrorCodes(List<Integer> nonFatalErrorCodes) {
73-
this.nonFatalErrorCodes = nonFatalErrorCodes;
74-
}
75-
7661
@Override
7762
public List<String> getNonFatalErrorMessages() {
7863
return nonFatalErrorMessages;
7964
}
80-
81-
/**
82-
* Sets the non fatal error messages.
83-
*
84-
* @param nonFatalErrorMessages the non-fatal error messages.
85-
*/
86-
public void setNonFatalErrorMessages(List<String> nonFatalErrorMessages) {
87-
this.nonFatalErrorMessages = nonFatalErrorMessages;
88-
}
89-
90-
@Override
91-
public String toString() {
92-
return MoreObjects.toStringHelper(this)
93-
.add("connectionTimeout", connectionTimeout)
94-
.add("nonFatalErrorCodes", nonFatalErrorCodes)
95-
.add("nonFatalErrorMessages", nonFatalErrorMessages)
96-
.toString();
97-
}
9865
}

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/exchange/OtherConfigImpl.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,18 @@
2424
package com.gazbert.bxbot.core.config.exchange;
2525

2626
import com.gazbert.bxbot.exchange.api.OtherConfig;
27-
import com.google.common.base.MoreObjects;
2827
import java.util.HashMap;
2928
import java.util.Map;
29+
import lombok.Setter;
30+
import lombok.ToString;
3031

3132
/**
3233
* Exchange API Other config.
3334
*
3435
* @author gazbert
3536
*/
37+
@Setter
38+
@ToString
3639
public class OtherConfigImpl implements OtherConfig {
3740

3841
private Map<String, String> items;
@@ -55,18 +58,4 @@ public String getItem(String name) {
5558
Map<String, String> getItems() {
5659
return items;
5760
}
58-
59-
/**
60-
* Sets the config items.
61-
*
62-
* @param items the config items.
63-
*/
64-
public void setItems(Map<String, String> items) {
65-
this.items = items;
66-
}
67-
68-
@Override
69-
public String toString() {
70-
return MoreObjects.toStringHelper(this).add("items", items).toString();
71-
}
7261
}

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/market/MarketImpl.java

+4-20
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@
2424
package com.gazbert.bxbot.core.config.market;
2525

2626
import com.gazbert.bxbot.trading.api.Market;
27-
import com.google.common.base.MoreObjects;
2827
import com.google.common.base.Objects;
28+
import lombok.Setter;
29+
import lombok.ToString;
2930

3031
/**
3132
* Holds information for an Exchange market.
3233
*
3334
* @author gazbert
3435
*/
36+
@Setter
37+
@ToString
3538
public final class MarketImpl implements Market {
3639

3740
private String name;
@@ -54,15 +57,6 @@ public MarketImpl(String name, String id, String baseCurrency, String counterCur
5457
this.counterCurrency = counterCurrency;
5558
}
5659

57-
/**
58-
* Sets the name.
59-
*
60-
* @param name the name.
61-
*/
62-
public void setName(String name) {
63-
this.name = name;
64-
}
65-
6660
@Override
6761
public String getName() {
6862
return name;
@@ -122,14 +116,4 @@ public boolean equals(Object o) {
122116
public int hashCode() {
123117
return Objects.hashCode(id);
124118
}
125-
126-
@Override
127-
public String toString() {
128-
return MoreObjects.toStringHelper(this)
129-
.add("name", name)
130-
.add("id", id)
131-
.add("baseCurrency", baseCurrency)
132-
.add("counterCurrency", counterCurrency)
133-
.toString();
134-
}
135119
}

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/strategy/StrategyConfigItems.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@
2424
package com.gazbert.bxbot.core.config.strategy;
2525

2626
import com.gazbert.bxbot.strategy.api.StrategyConfig;
27-
import com.google.common.base.MoreObjects;
2827
import java.util.Collections;
2928
import java.util.HashMap;
3029
import java.util.Map;
3130
import java.util.Set;
31+
import lombok.Setter;
32+
import lombok.ToString;
3233

3334
/**
3435
* Encapsulates (optional) Strategy Config Items.
3536
*
3637
* @author gazbert
3738
*/
39+
@Setter
40+
@ToString
3841
public final class StrategyConfigItems implements StrategyConfig {
3942

4043
private Map<String, String> items = new HashMap<>();
@@ -59,15 +62,6 @@ public Set<String> getConfigItemKeys() {
5962
return Collections.unmodifiableSet(items.keySet());
6063
}
6164

62-
/**
63-
* Sets the config items.
64-
*
65-
* @param items the config items.
66-
*/
67-
public void setItems(Map<String, String> items) {
68-
this.items = items;
69-
}
70-
7165
/**
7266
* Returns the config items.
7367
*
@@ -76,9 +70,4 @@ public void setItems(Map<String, String> items) {
7670
Map<String, String> getItems() {
7771
return items;
7872
}
79-
80-
@Override
81-
public String toString() {
82-
return MoreObjects.toStringHelper(this).add("items", items).toString();
83-
}
8473
}

bxbot-core/src/main/java/com/gazbert/bxbot/core/config/strategy/TradingStrategiesBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public List<TradingStrategy> buildStrategies(
147147
tradingStrategiesToExecute.add(strategyImpl);
148148
} else {
149149

150-
// Game over. Config integrity blown - we can't find strat.
150+
// Game over. Config integrity blown - we can't find strategy.
151151
final String errorMsg =
152152
"Failed to find matching Strategy for Market "
153153
+ market

bxbot-core/src/main/java/com/gazbert/bxbot/core/mail/EmailAlertMessageBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535
public final class EmailAlertMessageBuilder {
3636

37-
private static final String NEWLINE = System.getProperty("line.separator");
37+
private static final String NEWLINE = System.lineSeparator();
3838
private static final String HORIZONTAL_RULE =
3939
"--------------------------------------------------" + NEWLINE;
4040

0 commit comments

Comments
 (0)