From 186b63044af80c657f0b2891496d3628d6481b17 Mon Sep 17 00:00:00 2001 From: pokkst Date: Tue, 4 Oct 2022 04:03:07 -0500 Subject: [PATCH] Get rid of lombok --- app/build.gradle | 3 -- .../java/net/mynero/wallet/data/Node.java | 32 +++++++------ .../net/mynero/wallet/data/Subaddress.java | 46 +++++++++++++------ .../mynero/wallet/model/TransactionInfo.java | 13 ++++-- .../java/net/mynero/wallet/model/Wallet.java | 17 +++++-- .../mynero/wallet/model/WalletManager.java | 3 -- 6 files changed, 69 insertions(+), 45 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 57d0b6b..3320a42 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -162,7 +162,4 @@ dependencies { testImplementation "com.squareup.okhttp3:mockwebserver:4.9.3" testImplementation 'org.json:json:20211205' testImplementation 'net.jodah:concurrentunit:0.4.6' - - compileOnly 'org.projectlombok:lombok:1.18.22' - annotationProcessor 'org.projectlombok:lombok:1.18.22' } diff --git a/app/src/main/java/net/mynero/wallet/data/Node.java b/app/src/main/java/net/mynero/wallet/data/Node.java index d4d0b96..900cc69 100644 --- a/app/src/main/java/net/mynero/wallet/data/Node.java +++ b/app/src/main/java/net/mynero/wallet/data/Node.java @@ -26,8 +26,6 @@ import java.net.URLDecoder; import java.net.URLEncoder; import java.net.UnknownHostException; -import lombok.Getter; -import lombok.Setter; import timber.log.Timber; public class Node { @@ -36,29 +34,33 @@ public class Node { static public final String TESTNET = "testnet"; static private int DEFAULT_LEVIN_PORT = 0; static private int DEFAULT_RPC_PORT = 0; - @Getter final private NetworkType networkType; - @Getter - @Setter private final boolean selected = false; - @Getter - @Setter int rpcPort = 0; - @Getter private String name = null; - @Getter private String host; private int levinPort = 0; - @Getter - @Setter private String username = ""; - @Getter - @Setter private String password = ""; - @Getter - @Setter private boolean favourite = false; + + public NetworkType getNetworkType() { + return networkType; + } + + public String getUsername() { + return this.username; + } + + public String getPassword() { + return this.password; + } + + public String getName() { + return this.name; + } + Node(String nodeString) { if ((nodeString == null) || nodeString.isEmpty()) throw new IllegalArgumentException("daemon is empty"); diff --git a/app/src/main/java/net/mynero/wallet/data/Subaddress.java b/app/src/main/java/net/mynero/wallet/data/Subaddress.java index 9a66a20..9a3920b 100644 --- a/app/src/main/java/net/mynero/wallet/data/Subaddress.java +++ b/app/src/main/java/net/mynero/wallet/data/Subaddress.java @@ -18,29 +18,21 @@ package net.mynero.wallet.data; import java.util.regex.Pattern; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import lombok.ToString; - -@RequiredArgsConstructor -@ToString -@EqualsAndHashCode public class Subaddress implements Comparable { public static final Pattern DEFAULT_LABEL_FORMATTER = Pattern.compile("^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}:[0-9]{2}:[0-9]{2}$"); - @Getter final private int accountIndex; - @Getter final private int addressIndex; - @Getter final private String address; - @Getter private final String label; - @Getter - @Setter private long amount; + public Subaddress(int accountIndex, int addressIndex, String address, String label) { + this.accountIndex = accountIndex; + this.addressIndex = addressIndex; + this.address = address; + this.label = label; + } + @Override public int compareTo(Subaddress another) { // newer is < final int compareAccountIndex = another.accountIndex - accountIndex; @@ -59,4 +51,28 @@ public class Subaddress implements Comparable { else return label; } + + public long getAmount() { + return amount; + } + + public String getAddress() { + return address; + } + + public int getAccountIndex() { + return accountIndex; + } + + public int getAddressIndex() { + return addressIndex; + } + + public String getLabel() { + return label; + } + + public void setAmount(long amount) { + this.amount = amount; + } } diff --git a/app/src/main/java/net/mynero/wallet/model/TransactionInfo.java b/app/src/main/java/net/mynero/wallet/model/TransactionInfo.java index 3d2949c..aaff1e4 100644 --- a/app/src/main/java/net/mynero/wallet/model/TransactionInfo.java +++ b/app/src/main/java/net/mynero/wallet/model/TransactionInfo.java @@ -23,9 +23,6 @@ import net.mynero.wallet.data.Subaddress; import java.util.List; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - // this is not the TransactionInfo from the API as that is owned by the TransactionHistory // this is a POJO for the TransactionInfoAdapter public class TransactionInfo implements Parcelable, Comparable { @@ -163,14 +160,20 @@ public class TransactionInfo implements Parcelable, Comparable } } - @RequiredArgsConstructor public enum Direction { Direction_In(0), Direction_Out(1); - @Getter private final int value; + Direction(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + public static Direction fromInteger(int n) { switch (n) { case 0: diff --git a/app/src/main/java/net/mynero/wallet/model/Wallet.java b/app/src/main/java/net/mynero/wallet/model/Wallet.java index 500bf62..cb02d30 100644 --- a/app/src/main/java/net/mynero/wallet/model/Wallet.java +++ b/app/src/main/java/net/mynero/wallet/model/Wallet.java @@ -31,8 +31,6 @@ import java.util.Date; import java.util.List; import java.util.Locale; -import lombok.Getter; -import lombok.RequiredArgsConstructor; import timber.log.Timber; public class Wallet { @@ -460,14 +458,25 @@ public class Wallet { private native int getDeviceTypeJ(); - @RequiredArgsConstructor - @Getter public enum Device { Device_Undefined(0, 0), Device_Software(50, 200), Device_Ledger(5, 20); private final int accountLookahead; private final int subaddressLookahead; + + Device(int accountLookahead, int subaddressLookahead) { + this.accountLookahead = accountLookahead; + this.subaddressLookahead = subaddressLookahead; + } + + public int getAccountLookahead() { + return accountLookahead; + } + + public int getSubaddressLookahead() { + return subaddressLookahead; + } } public enum StatusEnum { diff --git a/app/src/main/java/net/mynero/wallet/model/WalletManager.java b/app/src/main/java/net/mynero/wallet/model/WalletManager.java index 6a4beb4..a7d0788 100644 --- a/app/src/main/java/net/mynero/wallet/model/WalletManager.java +++ b/app/src/main/java/net/mynero/wallet/model/WalletManager.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import lombok.Getter; import timber.log.Timber; public class WalletManager { @@ -325,9 +324,7 @@ public class WalletManager { public native boolean setProxyJ(String address); public class WalletInfo implements Comparable { - @Getter final private File path; - @Getter final private String name; public WalletInfo(File wallet) {