类 URLParam
- java.lang.Object
-
- org.apache.dubbo.common.url.component.URLParam
-
- 直接已知子类:
URLPlainParam
public class URLParam extends Object
A class which store parameters forURL
UsingDynamicParamTableto compress common keys (i.e. side, version)
DynamicParamTableallow to use only two integer value named `key` and `value-offset` to find a unique string to string key-pair. Also, `value-offset` is not required if the real value is the default value.
URLParam should operate as Copy-On-Write, each modify actions will return a new Object
NOTE: URLParam is not support serialization!DynamicParamTableis related with current running environment. If you want to make URL as a parameter, please callURL.toSerializableURL()to createURLPlainParaminstead.- 从以下版本开始:
- 3.0
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classURLParam.URLParamMapAn embedded Map adapt to URLParam
copy-on-write mode, urlParam reference will be changed after modify actions.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 URLParamaddParameter(String key, String value)Add parameters to a new URLParam.URLParamaddParameterIfAbsent(String key, String value)Add absent parameters to a new URLParam.URLParamaddParameters(Map<String,String> parameters)Add parameters to a new URLParam.URLParamaddParametersIfAbsent(Map<String,String> parameters)Add absent parameters to a new URLParam.URLParamclearParameters()remove all of the parameters in URLParambooleanequals(Object o)StringgetAnyMethodParameter(String key)Get any method related parameter which match keyStringgetMethodParameter(String method, String key)Get method related parameter.StringgetMethodParameterStrict(String method, String key)Get method related parameter.StringgetParameter(String key)get value of specified key in URLParamMap<String,String>getParameters()Get a Map like URLParamStringgetRawParam()get raw string like parameterslonggetTimestamp()inthashCode()booleanhasMethodParameter(String method)Weather there contains some parameter match methodbooleanhasParameter(String key)check if specified key is present in URLParamstatic Map<String,Map<String,String>>initMethodParameters(Map<String,String> parameters)static URLParamparse(String rawParam)Parse URLParam Init URLParam by constructor is not allowedstatic URLParamparse(String rawParam, boolean encoded, Map<String,String> extraParameters)Parse URLParam Init URLParam by constructor is not allowedstatic URLParamparse(Map<String,String> params)Parse URLParam Init URLParam by constructor is not allowed rawParam field in result will be null whilegetRawParam()will automatically create itstatic URLParamparse(Map<String,String> params, String rawParam)Parse URLParam Init URLParam by constructor is not allowedURLParamremoveParameters(String... keys)remove specified parameters in URLParamvoidsetTimestamp(long timestamp)StringtoString()
-
-
-
方法详细资料
-
hasMethodParameter
public boolean hasMethodParameter(String method)
Weather there contains some parameter match method- 参数:
method- method name- 返回:
- contains or not
-
getMethodParameter
public String getMethodParameter(String method, String key)
Get method related parameter. If not contains, use getParameter(key) instead. Specially, in some situation like `method1.1.callback=true`, key is `1.callback`.- 参数:
method- method namekey- key- 返回:
- value
-
getMethodParameterStrict
public String getMethodParameterStrict(String method, String key)
Get method related parameter. If not contains, return null. Specially, in some situation like `method1.1.callback=true`, key is `1.callback`.- 参数:
method- method namekey- key- 返回:
- value
-
initMethodParameters
public static Map<String,Map<String,String>> initMethodParameters(Map<String,String> parameters)
-
getParameters
public Map<String,String> getParameters()
Get a Map like URLParam- 返回:
- a
URLParam.URLParamMapadapt to URLParam
-
getAnyMethodParameter
public String getAnyMethodParameter(String key)
Get any method related parameter which match key- 参数:
key- key- 返回:
- result ( if any, random choose one )
-
addParameter
public URLParam addParameter(String key, String value)
Add parameters to a new URLParam.- 参数:
key- keyvalue- value- 返回:
- A new URLParam
-
addParameterIfAbsent
public URLParam addParameterIfAbsent(String key, String value)
Add absent parameters to a new URLParam.- 参数:
key- keyvalue- value- 返回:
- A new URLParam
-
addParameters
public URLParam addParameters(Map<String,String> parameters)
Add parameters to a new URLParam. If key-pair is present, this will cover it.- 参数:
parameters- parameters in key-value pairs- 返回:
- A new URLParam
-
addParametersIfAbsent
public URLParam addParametersIfAbsent(Map<String,String> parameters)
Add absent parameters to a new URLParam.- 参数:
parameters- parameters in key-value pairs- 返回:
- A new URL
-
removeParameters
public URLParam removeParameters(String... keys)
remove specified parameters in URLParam- 参数:
keys- keys to being removed- 返回:
- A new URLParam
-
clearParameters
public URLParam clearParameters()
remove all of the parameters in URLParam- 返回:
- An empty URLParam
-
hasParameter
public boolean hasParameter(String key)
check if specified key is present in URLParam- 参数:
key- specified key- 返回:
- present or not
-
getParameter
public String getParameter(String key)
get value of specified key in URLParam- 参数:
key- specified key- 返回:
- value, null if key is absent
-
getRawParam
public String getRawParam()
get raw string like parameters- 返回:
- raw string like parameters
-
getTimestamp
public long getTimestamp()
-
setTimestamp
public void setTimestamp(long timestamp)
-
parse
public static URLParam parse(Map<String,String> params)
Parse URLParam Init URLParam by constructor is not allowed rawParam field in result will be null whilegetRawParam()will automatically create it- 参数:
params- params map added into URLParam- 返回:
- a new URLParam
-
parse
public static URLParam parse(String rawParam, boolean encoded, Map<String,String> extraParameters)
Parse URLParam Init URLParam by constructor is not allowed- 参数:
rawParam- original rawParam stringencoded- if parameters are URL encodedextraParameters- extra parameters to add into URLParam- 返回:
- a new URLParam
-
parse
public static URLParam parse(String rawParam)
Parse URLParam Init URLParam by constructor is not allowed- 参数:
rawParam- original rawParam string- 返回:
- a new URLParam
-
parse
public static URLParam parse(Map<String,String> params, String rawParam)
Parse URLParam Init URLParam by constructor is not allowed- 参数:
params- params map added into URLParamrawParam- original rawParam string, directly add to rawParam field, will not effect real key-pairs store in URLParam. Please make sure it can correspond with params or will cause unexpected result when callinggetRawParam()andtoString()()}. If you not sure, you can callparse(String)to init.- 返回:
- a new URLParam
-
-