Refactoring:

-Reduce visibility
This commit is contained in:
chimp1984 2020-08-30 19:09:04 -05:00
parent b76357e620
commit ef9ac12519
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
5 changed files with 14 additions and 14 deletions

View file

@ -64,12 +64,12 @@ public class XmrAutoConfirmResult extends AutoConfirmResult {
this(State.UNDEFINED, 0, 0); this(State.UNDEFINED, 0, 0);
} }
public XmrAutoConfirmResult(State state) { XmrAutoConfirmResult(State state) {
this(state, 0, 0); this(state, 0, 0);
} }
// alternate constructor for showing confirmation progress information // alternate constructor for showing confirmation progress information
public XmrAutoConfirmResult(State state, int confirmCount, int confirmsRequired) { XmrAutoConfirmResult(State state, int confirmCount, int confirmsRequired) {
super(state.name()); super(state.name());
this.state = state; this.state = state;
this.confirmCount = confirmCount; this.confirmCount = confirmCount;
@ -77,7 +77,7 @@ public class XmrAutoConfirmResult extends AutoConfirmResult {
} }
// alternate constructor for error scenarios // alternate constructor for error scenarios
public XmrAutoConfirmResult(State state, @Nullable String errorMsg) { XmrAutoConfirmResult(State state, @Nullable String errorMsg) {
this(state, 0, 0); this(state, 0, 0);
if (!isPendingState() && !isSuccessState() && state != State.FEATURE_DISABLED && state != State.UNDEFINED) { if (!isPendingState() && !isSuccessState() && state != State.FEATURE_DISABLED && state != State.UNDEFINED) {

View file

@ -24,7 +24,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
@Value @Value
public class XmrProofInfo { class XmrProofInfo {
private final String txHash; private final String txHash;
private final String txKey; private final String txKey;
private final String recipientAddress; private final String recipientAddress;
@ -33,7 +33,7 @@ public class XmrProofInfo {
private final int confirmsRequired; private final int confirmsRequired;
private final String serviceAddress; private final String serviceAddress;
public XmrProofInfo( XmrProofInfo(
String txHash, String txHash,
String txKey, String txKey,
String recipientAddress, String recipientAddress,
@ -50,7 +50,7 @@ public class XmrProofInfo {
this.serviceAddress = serviceAddress; this.serviceAddress = serviceAddress;
} }
public String getUID() { String getUID() {
return txHash + "|" + serviceAddress; return txHash + "|" + serviceAddress;
} }
} }

View file

@ -32,8 +32,8 @@ import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class XmrProofParser { class XmrProofParser {
static public XmrAutoConfirmResult parse(XmrProofInfo xmrProofInfo, String jsonTxt) { static XmrAutoConfirmResult parse(XmrProofInfo xmrProofInfo, String jsonTxt) {
String txHash = xmrProofInfo.getTxHash(); String txHash = xmrProofInfo.getTxHash();
try { try {
JsonObject json = new Gson().fromJson(jsonTxt, JsonObject.class); JsonObject json = new Gson().fromJson(jsonTxt, JsonObject.class);

View file

@ -81,11 +81,11 @@ class XmrTransferProofRequester {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// used by the service to abort further automatic retries // used by the service to abort further automatic retries
public void stop() { void stop() {
terminated = true; terminated = true;
} }
public void request() { void request() {
if (terminated) { if (terminated) {
// the XmrTransferProofService has asked us to terminate i.e. not make any further api calls // the XmrTransferProofService has asked us to terminate i.e. not make any further api calls
// this scenario may happen if a re-request is scheduled from the callback below // this scenario may happen if a re-request is scheduled from the callback below

View file

@ -45,7 +45,7 @@ class XmrTransferProofService {
socks5ProxyProvider = provider; socks5ProxyProvider = provider;
} }
public void requestProof(XmrProofInfo xmrProofInfo, void requestProof(XmrProofInfo xmrProofInfo,
Consumer<XmrAutoConfirmResult> resultHandler, Consumer<XmrAutoConfirmResult> resultHandler,
FaultHandler faultHandler) { FaultHandler faultHandler) {
String uid = xmrProofInfo.getUID(); String uid = xmrProofInfo.getUID();
@ -72,7 +72,7 @@ class XmrTransferProofService {
requester.request(); requester.request();
} }
public void terminateRequest(XmrProofInfo xmrProofInfo) { void terminateRequest(XmrProofInfo xmrProofInfo) {
String uid = xmrProofInfo.getUID(); String uid = xmrProofInfo.getUID();
XmrTransferProofRequester requester = map.getOrDefault(uid, null); XmrTransferProofRequester requester = map.getOrDefault(uid, null);
if (requester != null) { if (requester != null) {