zrlw edited a comment on issue #8742:
URL: https://github.com/apache/dubbo/issues/8742#issuecomment-917952883


   
URL应该不是为了你这种应用场景设计的,你不需要URL,只需要一个承载URL的字符串,直接传url的字符串就好了,然后用URL.valueOf重新构造出来。
   最多再加个包装类,比如:
   ```
   public class MyURL implements Serializable  {
           private static final long serialVersionUID = 1L;
           private String url;
           public MyURL(String url) {
               this.url = url;
           }
           public URL getUrl() {
               return URL.valueOf(url);
           }
           @Override
           public String toString() {
               return url;
           }
           @Override
           public int hashCode() {
               return Objects.hash(url);
           }
           @Override
           public boolean equals(Object obj) {
               if (this == obj) {
                   return true;
               }
               if (obj == null) {
                   return false;
               }
               if (!(obj instanceof MyURL)) {
                   return false;
               }
               MyURL other = (MyURL) obj;
               return Objects.equals(this.getUrl(), other.getUrl());
           }
   }
   ```


-- 
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]

Reply via email to