You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/09/09 08:57:37 UTC

[dubbo] branch 3.0 updated: Add ConsumerUrl adapt to ServiceAddressURL (#8731)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new bed2605  Add ConsumerUrl adapt to ServiceAddressURL (#8731)
bed2605 is described below

commit bed2605285311a5c39c2047ec4f4411b686c6e7d
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Sep 9 16:57:25 2021 +0800

    Add ConsumerUrl adapt to ServiceAddressURL (#8731)
---
 .../common/url/component/ServiceAddressURL.java    | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/ServiceAddressURL.java b/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/ServiceAddressURL.java
index af27557..619c6c9 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/ServiceAddressURL.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/url/component/ServiceAddressURL.java
@@ -18,6 +18,8 @@ package org.apache.dubbo.common.url.component;
 
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.utils.StringUtils;
+import org.apache.dubbo.rpc.model.ScopeModel;
+import org.apache.dubbo.rpc.model.ServiceModel;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -212,6 +214,26 @@ public abstract class ServiceAddressURL extends URL {
         return super.hashCode();
     }
 
+    @Override
+    public ScopeModel getScopeModel() {
+        return consumerURL.getScopeModel();
+    }
+
+    @Override
+    public ServiceModel getServiceModel() {
+        return consumerURL.getServiceModel();
+    }
+
+    @Override
+    public URL setScopeModel(ScopeModel scopeModel) {
+        throw new UnsupportedOperationException("setScopeModel is forbidden for ServiceAddressURL");
+    }
+
+    @Override
+    public URL setServiceModel(ServiceModel serviceModel) {
+        throw new UnsupportedOperationException("setServiceModel is forbidden for ServiceAddressURL");
+    }
+
     /**
      * ignore consumer url compare.
      * It's only meaningful for comparing two address urls related to the same consumerURL.