类 NamingUtils
java.lang.Object
com.alibaba.nacos.api.naming.utils.NamingUtils
NamingUtils.
- 从以下版本开始:
- 1.0.0
- 作者:
- nkorange
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidbatchCheckInstanceIsLegal(List<Instance> instances) Batch verify the validity of instances.static voidcheckInstanceIsEphemeral(Instance instance) check batch register is Ephemeral.static voidcheckInstanceIsLegal(Instance instance) Check instance param about keep alive.static voidcheckServiceNameFormat(String combineServiceName) check combineServiceName format. the serviceName can't be blank.static StringgetGroupedName(String serviceName, String groupName) Returns a combined string with serviceName and groupName. serviceName can not be nil.static StringgetGroupedNameOptional(String serviceName, String groupName) Returns a combined string with serviceName and groupName.static StringgetGroupName(String serviceNameWithGroup) static StringgetServiceKey(String namespace, String group, String serviceName) static StringgetServiceName(String serviceNameWithGroup) static booleanCheck string is a number or not.static booleanisServiceNameCompatibilityMode(String serviceName) Check serviceName is compatibility mode or not.static String[]parseServiceKey(String serviceKey) parse service key items for serviceKey. item[0] for namespace item[1] for group item[2] for service name
-
构造器详细资料
-
NamingUtils
public NamingUtils()
-
-
方法详细资料
-
getGroupedName
Returns a combined string with serviceName and groupName. serviceName can not be nil.In most cases, serviceName can not be nil. In other cases, for search or anything, See
getGroupedNameOptional(String, String)etc:
serviceName | groupName | result
serviceA | groupA | groupA@@serviceA
nil | groupA | threw IllegalArgumentException
- 返回:
- 'groupName@@serviceName'
-
getServiceKey
-
parseServiceKey
parse service key items for serviceKey. item[0] for namespace item[1] for group item[2] for service name- 参数:
serviceKey- serviceKey.- 返回:
-
getServiceName
-
getGroupName
-
isServiceNameCompatibilityMode
Check serviceName is compatibility mode or not.- 参数:
serviceName- serviceName- 返回:
- if serviceName is compatibility mode, return true
-
checkServiceNameFormat
check combineServiceName format. the serviceName can't be blank.serviceName = "@@"; the length = 0; illegal serviceName = "group@@"; the length = 1; illegal serviceName = "@@serviceName"; the length = 2; illegal serviceName = "group@@serviceName"; the length = 2; legal
- 参数:
combineServiceName- such as: groupName@@serviceName
-
getGroupedNameOptional
Returns a combined string with serviceName and groupName. Such as 'groupName@@serviceName'This method works similar with
etc:getGroupedName(java.lang.String, java.lang.String)But not verify any parameters.serviceName | groupName | result
serviceA | groupA | groupA@@serviceA
nil | groupA | groupA@@
nil | nil | @@
- 返回:
- 'groupName@@serviceName'
-
checkInstanceIsLegal
Check instance param about keep alive.
heart beat timeout must > heart beat interval ip delete timeout must > heart beat interval
- 参数:
instance- need checked instance- 抛出:
NacosException- if check failed, throw exception
-
checkInstanceIsEphemeral
check batch register is Ephemeral.- 参数:
instance- instance- 抛出:
NacosException- NacosException
-
batchCheckInstanceIsLegal
Batch verify the validity of instances.- 参数:
instances- List of instances to be registered- 抛出:
NacosException- Nacos
-
isNumber
Check string is a number or not.- 参数:
str- a string of digits- 返回:
- if it is a string of digits, return true
-