You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/07/30 14:00:14 UTC

[GitHub] [dubbo] BurningCN commented on a diff in pull request #10389: Optimize the logic of ConfigConfigurationAdapter to get prefixed meta…

BurningCN commented on code in PR #10389:
URL: https://github.com/apache/dubbo/pull/10389#discussion_r933809844


##########
dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java:
##########
@@ -514,8 +525,12 @@ protected void appendAnnotation(Class<?> annotationClass, Object annotation) {
      * @see AbstractConfig#appendParameters(Map, Object, String)
      */
     public Map<String, String> getMetaData() {
+        return getMetaData(null);
+    }
+
+    public Map<String, String> getMetaData(String prefix) {
         Map<String, String> metaData = new HashMap<>();
-        appendAttributes(metaData, this);
+        appendAttributes(metaData, this, prefix);

Review Comment:
   在原来getMetaData()的基础上,再添加一个带有prefix参数的重载的getMetaData方法。这样ConfigConfigurationAdapter在获取带前缀的元数据的时候直接调用此方法(`getMetaData(String prefix)`)就可以了,不需要再像原来的逻辑 getMetaData() + 遍历entry对每个key拼上prefix。



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org