URL implements Serializable { public URL addParameters(Map<String, String> parameters) { if (parameters == null || parameters.size() == 0) { return this; } boolean hasAndEqual = true; for (Map.Entry<String, String> entry : parameters.entrySet()) { String value = getParameters().get(entry.getKey()); if (value == null) { if (entry.getValue() != null) { hasAndEqual = false; break; } } else { if (!value.equals(entry.getValue())) { hasAndEqual = false; break; } } } if (hasAndEqual) return this; Map<String, String> map = new HashMap<String, String>(getParameters()); map.putAll(parameters); return new URL(protocol, username, password, host, port, path, map); } protected  URL();  URL(String protocol, String host, int port);  URL(String protocol, String host, int port, String[] pairs);  URL(String protocol, String host, int port, Map<String, String> parameters);  URL(String protocol, String host, int port, String path);  URL(String protocol, String host, int port, String path, String... pairs);  URL(String protocol, String host, int port, String path, Map<String, String> parameters);  URL(String protocol, String username, String password, String host, int port, String path);  URL(String protocol, String username, String password, String host, int port, String path, String... pairs);  URL(String protocol, String username, String password, String host, int port, String path, Map<String, String> parameters); static URL valueOf(String url); static String encode(String value); static String decode(String value); String getProtocol(); URL setProtocol(String protocol); String getUsername(); URL setUsername(String username); String getPassword(); URL setPassword(String password); String getAuthority(); String getHost(); URL setHost(String host); String getIp(); int getPort(); URL setPort(int port); int getPort(int defaultPort); String getAddress(); URL setAddress(String address); String getBackupAddress(); String getBackupAddress(int defaultPort); List<URL> getBackupUrls(); String getPath(); URL setPath(String path); String getAbsolutePath(); Map<String, String> getParameters(); String getParameterAndDecoded(String key); String getParameterAndDecoded(String key, String defaultValue); String getParameter(String key); String getParameter(String key, String defaultValue); String[] getParameter(String key, String[] defaultValue); URL getUrlParameter(String key); double getParameter(String key, double defaultValue); float getParameter(String key, float defaultValue); long getParameter(String key, long defaultValue); int getParameter(String key, int defaultValue); short getParameter(String key, short defaultValue); byte getParameter(String key, byte defaultValue); float getPositiveParameter(String key, float defaultValue); double getPositiveParameter(String key, double defaultValue); long getPositiveParameter(String key, long defaultValue); int getPositiveParameter(String key, int defaultValue); short getPositiveParameter(String key, short defaultValue); byte getPositiveParameter(String key, byte defaultValue); char getParameter(String key, char defaultValue); boolean getParameter(String key, boolean defaultValue); boolean hasParameter(String key); String getMethodParameterAndDecoded(String method, String key); String getMethodParameterAndDecoded(String method, String key, String defaultValue); String getMethodParameter(String method, String key); String getMethodParameter(String method, String key, String defaultValue); double getMethodParameter(String method, String key, double defaultValue); float getMethodParameter(String method, String key, float defaultValue); long getMethodParameter(String method, String key, long defaultValue); int getMethodParameter(String method, String key, int defaultValue); short getMethodParameter(String method, String key, short defaultValue); byte getMethodParameter(String method, String key, byte defaultValue); double getMethodPositiveParameter(String method, String key, double defaultValue); float getMethodPositiveParameter(String method, String key, float defaultValue); long getMethodPositiveParameter(String method, String key, long defaultValue); int getMethodPositiveParameter(String method, String key, int defaultValue); short getMethodPositiveParameter(String method, String key, short defaultValue); byte getMethodPositiveParameter(String method, String key, byte defaultValue); char getMethodParameter(String method, String key, char defaultValue); boolean getMethodParameter(String method, String key, boolean defaultValue); boolean hasMethodParameter(String method, String key); boolean isLocalHost(); boolean isAnyHost(); URL addParameterAndEncoded(String key, String value); URL addParameter(String key, boolean value); URL addParameter(String key, char value); URL addParameter(String key, byte value); URL addParameter(String key, short value); URL addParameter(String key, int value); URL addParameter(String key, long value); URL addParameter(String key, float value); URL addParameter(String key, double value); URL addParameter(String key, Enum<?> value); URL addParameter(String key, Number value); URL addParameter(String key, CharSequence value); URL addParameter(String key, String value); URL addParameterIfAbsent(String key, String value); URL addParameters(Map<String, String> parameters); URL addParametersIfAbsent(Map<String, String> parameters); URL addParameters(String... pairs); URL addParameterString(String query); URL removeParameter(String key); URL removeParameters(Collection<String> keys); URL removeParameters(String... keys); URL clearParameters(); String getRawParameter(String key); Map<String, String> toMap(); @Override String toString(); String toString(String... parameters); String toIdentityString(); String toIdentityString(String... parameters); String toFullString(); String toFullString(String... parameters); String toParameterString(); String toParameterString(String... parameters); java.net.URL toJavaURL(); InetSocketAddress toInetSocketAddress(); String getServiceKey(); String toServiceStringWithoutResolving(); String toServiceString(); @Deprecated String getServiceName(); String getServiceInterface(); URL setServiceInterface(String service); @Deprecated int getIntParameter(String key); @Deprecated int getIntParameter(String key, int defaultValue); @Deprecated int getPositiveIntParameter(String key, int defaultValue); @Deprecated boolean getBooleanParameter(String key); @Deprecated boolean getBooleanParameter(String key, boolean defaultValue); @Deprecated int getMethodIntParameter(String method, String key); @Deprecated int getMethodIntParameter(String method, String key, int defaultValue); @Deprecated int getMethodPositiveIntParameter(String method, String key, int defaultValue); @Deprecated boolean getMethodBooleanParameter(String method, String key); @Deprecated boolean getMethodBooleanParameter(String method, String key, boolean defaultValue); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testAddParameters() throws Exception { URL url = URL.valueOf("dubbo: Map<String, String> parameters = new HashMap<String, String>(); parameters.put("version", null); url.addParameters(parameters); }