EarthChen commented on code in PR #10313:
URL: https://github.com/apache/dubbo/pull/10313#discussion_r920766067
##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java:
##########
@@ -343,37 +312,91 @@ public boolean hasMethodParameter(String method, String
key) {
* @return
*/
@Override
- public boolean hasServiceMethodParameter(String protocolServiceKey, String
method) {
- URL consumerUrl = RpcContext.getServiceContext().getConsumerUrl();
- if (consumerUrl != null) {
- if (consumerUrl.hasServiceMethodParameter(protocolServiceKey,
method)) {
- return true;
- }
+ public boolean hasServiceMethodParameter(final String protocolServiceKey,
final String method) {
+ if
(hasParameterOnConsumerUrl(ParameterOnConsumerUrl.ServiceMethodParameter,
protocolServiceKey, method, null, false)) {
+ return true;
}
-
MetadataInfo.ServiceInfo serviceInfo =
getServiceInfo(protocolServiceKey);
if (null == serviceInfo) {
return false;
}
-
return serviceInfo.hasMethodParameter(method);
}
@Override
- public boolean hasMethodParameter(String method) {
- URL consumerUrl = RpcContext.getServiceContext().getConsumerUrl();
- if (consumerUrl != null) {
- if (consumerUrl.hasMethodParameter(method)) {
- return true;
- }
+ public boolean hasMethodParameter(final String method) {
+ if (hasParameterOnConsumerUrl(ParameterOnConsumerUrl.MethodParameter,
null, method, null, false)) {
+ return true;
}
-
String protocolServiceKey = getProtocolServiceKey();
if (isEmpty(protocolServiceKey)) {
return false;
}
return hasServiceMethodParameter(protocolServiceKey, method);
}
+
+ private String getParameterOnConsumerUrl(final ParameterOnConsumerUrl
parameterOnConsumerUrl, final URL consumerUrl,
Review Comment:
replace `if return` is better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]