Skip to content

Commit

Permalink
#169 - Lombok + Intellisense cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gazbert committed Nov 12, 2024
1 parent 6c5d394 commit d76e5fc
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
import com.gazbert.bxbot.exchange.api.AuthenticationConfig;
import java.util.HashMap;
import java.util.Map;
import lombok.Setter;

/**
* Exchange API Authentication config.
*
* @author gazbert
*/
@Setter
public class AuthenticationConfigImpl implements AuthenticationConfig {

private Map<String, String> items;
Expand All @@ -54,13 +56,4 @@ public String getItem(String name) {
Map<String, String> getItems() {
return items;
}

/**
* Sets the config items.
*
* @param items the config items.
*/
public void setItems(Map<String, String> items) {
this.items = items;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,23 @@
import com.gazbert.bxbot.exchange.api.ExchangeConfig;
import com.gazbert.bxbot.exchange.api.NetworkConfig;
import com.gazbert.bxbot.exchange.api.OtherConfig;
import com.google.common.base.MoreObjects;
import lombok.Setter;
import lombok.ToString;

/**
* Exchange API Exchange config.
*
* @author gazbert
*/
@Setter
@ToString
public class ExchangeConfigImpl implements ExchangeConfig {

private String exchangeName;
private String exchangeAdapter;
private AuthenticationConfig authenticationConfig;

@ToString.Exclude private AuthenticationConfig authenticationConfig;

private NetworkConfig networkConfig;
private OtherConfig otherConfig;

Expand Down Expand Up @@ -80,24 +85,6 @@ public AuthenticationConfig getAuthenticationConfig() {
return authenticationConfig;
}

/**
* Sets the authentication config.
*
* @param authenticationConfig authentication config.
*/
public void setAuthenticationConfig(AuthenticationConfig authenticationConfig) {
this.authenticationConfig = authenticationConfig;
}

/**
* Sets the network config.
*
* @param networkConfig the network config.
*/
public void setNetworkConfig(NetworkConfig networkConfig) {
this.networkConfig = networkConfig;
}

@Override
public NetworkConfig getNetworkConfig() {
return networkConfig;
Expand All @@ -107,24 +94,4 @@ public NetworkConfig getNetworkConfig() {
public OtherConfig getOtherConfig() {
return otherConfig;
}

/**
* Sets the other config.
*
* @param otherConfig the other config.
*/
public void setOtherConfig(OtherConfig otherConfig) {
this.otherConfig = otherConfig;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("exchangeName", exchangeName)
.add("exchangeAdapter", exchangeAdapter)
.add("authenticationConfig", "NOT SHOWN BY DESIGN")
.add("networkConfig", networkConfig)
.add("otherConfig", otherConfig)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@
package com.gazbert.bxbot.core.config.exchange;

import com.gazbert.bxbot.exchange.api.NetworkConfig;
import com.google.common.base.MoreObjects;
import java.util.ArrayList;
import java.util.List;
import lombok.Setter;
import lombok.ToString;

/**
* Exchange API Network config.
*
* @author gazbert
*/
@Setter
@ToString
public class NetworkConfigImpl implements NetworkConfig {

private Integer connectionTimeout;
Expand All @@ -50,49 +53,13 @@ public Integer getConnectionTimeout() {
return connectionTimeout;
}

/**
* Sets the connection timeout.
*
* @param connectionTimeout the connection timeout.
*/
public void setConnectionTimeout(Integer connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}

@Override
public List<Integer> getNonFatalErrorCodes() {
return nonFatalErrorCodes;
}

/**
* Sets the non-fatal error codes.
*
* @param nonFatalErrorCodes the non fatal error codes.
*/
public void setNonFatalErrorCodes(List<Integer> nonFatalErrorCodes) {
this.nonFatalErrorCodes = nonFatalErrorCodes;
}

@Override
public List<String> getNonFatalErrorMessages() {
return nonFatalErrorMessages;
}

/**
* Sets the non fatal error messages.
*
* @param nonFatalErrorMessages the non-fatal error messages.
*/
public void setNonFatalErrorMessages(List<String> nonFatalErrorMessages) {
this.nonFatalErrorMessages = nonFatalErrorMessages;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("connectionTimeout", connectionTimeout)
.add("nonFatalErrorCodes", nonFatalErrorCodes)
.add("nonFatalErrorMessages", nonFatalErrorMessages)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@
package com.gazbert.bxbot.core.config.exchange;

import com.gazbert.bxbot.exchange.api.OtherConfig;
import com.google.common.base.MoreObjects;
import java.util.HashMap;
import java.util.Map;
import lombok.Setter;
import lombok.ToString;

/**
* Exchange API Other config.
*
* @author gazbert
*/
@Setter
@ToString
public class OtherConfigImpl implements OtherConfig {

private Map<String, String> items;
Expand All @@ -55,18 +58,4 @@ public String getItem(String name) {
Map<String, String> getItems() {
return items;
}

/**
* Sets the config items.
*
* @param items the config items.
*/
public void setItems(Map<String, String> items) {
this.items = items;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("items", items).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
package com.gazbert.bxbot.core.config.market;

import com.gazbert.bxbot.trading.api.Market;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import lombok.Setter;
import lombok.ToString;

/**
* Holds information for an Exchange market.
*
* @author gazbert
*/
@Setter
@ToString
public final class MarketImpl implements Market {

private String name;
Expand All @@ -54,15 +57,6 @@ public MarketImpl(String name, String id, String baseCurrency, String counterCur
this.counterCurrency = counterCurrency;
}

/**
* Sets the name.
*
* @param name the name.
*/
public void setName(String name) {
this.name = name;
}

@Override
public String getName() {
return name;
Expand Down Expand Up @@ -122,14 +116,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hashCode(id);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("id", id)
.add("baseCurrency", baseCurrency)
.add("counterCurrency", counterCurrency)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@
package com.gazbert.bxbot.core.config.strategy;

import com.gazbert.bxbot.strategy.api.StrategyConfig;
import com.google.common.base.MoreObjects;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import lombok.Setter;
import lombok.ToString;

/**
* Encapsulates (optional) Strategy Config Items.
*
* @author gazbert
*/
@Setter
@ToString
public final class StrategyConfigItems implements StrategyConfig {

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

/**
* Sets the config items.
*
* @param items the config items.
*/
public void setItems(Map<String, String> items) {
this.items = items;
}

/**
* Returns the config items.
*
Expand All @@ -76,9 +70,4 @@ public void setItems(Map<String, String> items) {
Map<String, String> getItems() {
return items;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("items", items).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public List<TradingStrategy> buildStrategies(
tradingStrategiesToExecute.add(strategyImpl);
} else {

// Game over. Config integrity blown - we can't find strat.
// Game over. Config integrity blown - we can't find strategy.
final String errorMsg =
"Failed to find matching Strategy for Market "
+ market
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public final class EmailAlertMessageBuilder {

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

Expand Down

0 comments on commit d76e5fc

Please sign in to comment.