mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-11-02 18:26:43 +00:00
add null safe tests for standard account types
This commit is contained in:
parent
28551247c6
commit
94aafbc11e
2 changed files with 14 additions and 2 deletions
|
@ -67,4 +67,16 @@ public enum StandardAccount {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isMixableAccount(StandardAccount standardAccount) {
|
||||||
|
return standardAccount != null && MIXABLE_ACCOUNTS.contains(standardAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWhirlpoolAccount(StandardAccount standardAccount) {
|
||||||
|
return standardAccount != null && WHIRLPOOL_ACCOUNTS.contains(standardAccount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWhirlpoolMixAccount(StandardAccount standardAccount) {
|
||||||
|
return standardAccount != null && WHIRLPOOL_MIX_ACCOUNTS.contains(standardAccount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,11 +358,11 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWhirlpoolChildWallet() {
|
public boolean isWhirlpoolChildWallet() {
|
||||||
return !isMasterWallet() && getStandardAccountType() != null && StandardAccount.WHIRLPOOL_ACCOUNTS.contains(getStandardAccountType());
|
return !isMasterWallet() && getStandardAccountType() != null && StandardAccount.isWhirlpoolAccount(getStandardAccountType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWhirlpoolMixWallet() {
|
public boolean isWhirlpoolMixWallet() {
|
||||||
return !isMasterWallet() && getMasterWallet().isWhirlpoolMasterWallet() && StandardAccount.WHIRLPOOL_MIX_ACCOUNTS.contains(getStandardAccountType());
|
return !isMasterWallet() && getMasterWallet().isWhirlpoolMasterWallet() && StandardAccount.isWhirlpoolMixAccount(getStandardAccountType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
|
|
Loading…
Reference in a new issue