refactor: Use diamond operator

This commit is contained in:
Kyle Scully 2021-10-12 23:06:39 -07:00 committed by GitHub
parent fddb2f7a18
commit 0bcba32ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -19,7 +19,7 @@ import java.util.Map;
public class WxDnsResolver implements DnsResolver { public class WxDnsResolver implements DnsResolver {
private final static String WECHAT_API_URL = "api.weixin.qq.com"; private final static String WECHAT_API_URL = "api.weixin.qq.com";
private static Map<String, InetAddress[]> MAPPINGS = new HashMap<String, InetAddress[]>(); private static Map<String, InetAddress[]> MAPPINGS = new HashMap<>();
protected final Logger log = LoggerFactory.getLogger(WxDnsResolver.class); protected final Logger log = LoggerFactory.getLogger(WxDnsResolver.class);
private String wxApiIp; private String wxApiIp;
@ -38,7 +38,7 @@ public class WxDnsResolver implements DnsResolver {
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
//如果初始化DNS配置失败则使用默认配置,不影响服务的启动 //如果初始化DNS配置失败则使用默认配置,不影响服务的启动
log.error("init WxDnsResolver error", e); log.error("init WxDnsResolver error", e);
MAPPINGS = new HashMap<String, InetAddress[]>(); MAPPINGS = new HashMap<>();
} }
} }

View File

@ -79,7 +79,7 @@ public abstract class AbstractWxMaRedisConfig extends WxMaDefaultConfigImpl {
private void setValueToRedis(String key, long expiresTime, String value) { private void setValueToRedis(String key, long expiresTime, String value) {
try (Jedis jedis = getConfiguredJedis()) { try (Jedis jedis = getConfiguredJedis()) {
Map<String, String> hash = new HashMap<String, String>(); Map<String, String> hash = new HashMap<>();
hash.put(HASH_VALUE_FIELD, value); hash.put(HASH_VALUE_FIELD, value);
hash.put(HASH_EXPIRE_FIELD, String.valueOf(expiresTime)); hash.put(HASH_EXPIRE_FIELD, String.valueOf(expiresTime));
jedis.hmset(getRedisKey(key), hash); jedis.hmset(getRedisKey(key), hash);

View File

@ -33,23 +33,23 @@ public class WxMaShopAuditServiceImplTest {
WxMaShopAuditBrandRequest request = WxMaShopAuditBrandRequest.builder().build(); WxMaShopAuditBrandRequest request = WxMaShopAuditBrandRequest.builder().build();
WxMaShopAuditBrandRequest.AuditReqBean auditReqBean = WxMaShopAuditBrandRequest.AuditReqBean.builder().build(); WxMaShopAuditBrandRequest.AuditReqBean auditReqBean = WxMaShopAuditBrandRequest.AuditReqBean.builder().build();
auditReqBean.setLicense(new ArrayList<String>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))); auditReqBean.setLicense(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")));
auditReqBean.setBrandInfo(WxMaShopAuditBrandRequest.AuditReqBean.BrandInfoBean.builder() auditReqBean.setBrandInfo(WxMaShopAuditBrandRequest.AuditReqBean.BrandInfoBean.builder()
.brandAuditType(1) .brandAuditType(1)
.trademarkType("29") .trademarkType("29")
.brandManagementType(2) .brandManagementType(2)
.commodityOriginType(2) .commodityOriginType(2)
.brandWording("346225226351203275") .brandWording("346225226351203275")
.saleAuthorization(new ArrayList<String>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .saleAuthorization(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")))
.trademarkRegistrationCertificate(new ArrayList<String>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkRegistrationCertificate(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")))
.trademarkChangeCertificate(new ArrayList<String>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkChangeCertificate(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")))
.trademarkRegistrant("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg") .trademarkRegistrant("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")
.trademarkRegistrantNu("1249305") .trademarkRegistrantNu("1249305")
.trademarkAuthorizationPeriod("2020-03-25 12:05:25") .trademarkAuthorizationPeriod("2020-03-25 12:05:25")
.trademarkRegistrationApplication(new ArrayList<String>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkRegistrationApplication(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")))
.trademarkApplicant("张三") .trademarkApplicant("张三")
.trademarkApplicationTime("2020-03-25 12:05:25") .trademarkApplicationTime("2020-03-25 12:05:25")
.importedGoodsForm(new ArrayList<String>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .importedGoodsForm(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg")))
.build()); .build());
request.setAuditReq(auditReqBean); request.setAuditReq(auditReqBean);
@ -61,12 +61,12 @@ public class WxMaShopAuditServiceImplTest {
public void testAuditCategory() throws WxErrorException { public void testAuditCategory() throws WxErrorException {
WxMaShopAuditCategoryRequest request = WxMaShopAuditCategoryRequest.builder().build(); WxMaShopAuditCategoryRequest request = WxMaShopAuditCategoryRequest.builder().build();
WxMaShopAuditCategoryRequest.AuditReqBean auditReqBean = WxMaShopAuditCategoryRequest.AuditReqBean.builder().build(); WxMaShopAuditCategoryRequest.AuditReqBean auditReqBean = WxMaShopAuditCategoryRequest.AuditReqBean.builder().build();
auditReqBean.setLicense(new ArrayList<String>(Arrays.asList("www.xxxxx.com"))); auditReqBean.setLicense(new ArrayList<>(Arrays.asList("www.xxxxx.com")));
auditReqBean.setCategoryInfo(WxMaShopAuditCategoryRequest.AuditReqBean.CategoryInfoBean.builder() auditReqBean.setCategoryInfo(WxMaShopAuditCategoryRequest.AuditReqBean.CategoryInfoBean.builder()
.level1(7419) .level1(7419)
.level2(7439) .level2(7439)
.level3(7448) .level3(7448)
.certificate(new ArrayList<String>(Arrays.asList("www.xxxxx.com"))) .certificate(new ArrayList<>(Arrays.asList("www.xxxxx.com")))
.build()); .build());
request.setAuditReq(auditReqBean); request.setAuditReq(auditReqBean);
WxMaShopAuditCategoryResponse response = wxService.getShopAuditService().auditCategory(request); WxMaShopAuditCategoryResponse response = wxService.getShopAuditService().auditCategory(request);

View File

@ -17,7 +17,7 @@ public class WxOpenMessageRouter extends WxMpMessageRouter {
} }
public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, String appId) { public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, String appId) {
return route(wxMessage, new HashMap<String, Object>(), appId); return route(wxMessage, new HashMap<>(), appId);
} }
public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map<String, Object> context, String appId) { public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage, final Map<String, Object> context, String appId) {