package com.xcong.excoin.modules.okxNewPrice.okxpi.verify;
|
|
import lombok.Data;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.stereotype.Component;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* 账号验证工厂类
|
* 该类用于管理不同交易所的账号验证服务通过传入的键获取相应的验证服务
|
*/
|
@Component
|
@Data
|
public class VerifyAccountFactory {
|
|
/**
|
* OKX交易所的账号验证服务
|
*/
|
@Qualifier("oKXVerifyAccount")
|
private final IVerifyAccountService oKXVerifyAccount;
|
|
/**
|
* 存储不同交易所的账号验证服务的映射
|
*/
|
private Map<String, IVerifyAccountService> accountMap = new HashMap<>();
|
|
/**
|
* 构造方法,初始化账号验证工厂
|
* @param oKXVerifyAccount OKX交易所的账号验证服务
|
*/
|
public VerifyAccountFactory(IVerifyAccountService oKXVerifyAccount) {
|
this.oKXVerifyAccount = oKXVerifyAccount;
|
accountMap.put("OKX", oKXVerifyAccount);
|
}
|
|
/**
|
* 根据传入的键获取相应的账号验证服务
|
* @param key 交易所的键,如"OKX"或"BINANCE"
|
* @return 对应的账号验证服务
|
*/
|
public IVerifyAccountService get(String key) {
|
return accountMap.get(key);
|
}
|
}
|