public class NamingUtils extends Object
| 构造器和说明 |
|---|
NamingUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
batchCheckInstanceIsLegal(List<Instance> instances)
Batch verify the validity of instances.
|
static void |
checkInstanceIsEphemeral(Instance instance)
check batch register is Ephemeral.
|
static void |
checkInstanceIsLegal(Instance instance)
Check instance param about keep alive.
|
static void |
checkServiceNameFormat(String combineServiceName)
check combineServiceName format. the serviceName can't be blank.
|
static String |
getGroupedName(String serviceName,
String groupName)
Returns a combined string with serviceName and groupName. serviceName can not be nil.
|
static String |
getGroupedNameOptional(String serviceName,
String groupName)
Returns a combined string with serviceName and groupName.
|
static String |
getGroupName(String serviceNameWithGroup) |
static String |
getServiceName(String serviceNameWithGroup) |
static boolean |
isNumber(String str)
Check string is a number or not.
|
static boolean |
isServiceNameCompatibilityMode(String serviceName)
Check serviceName is compatibility mode or not.
|
public static String getGroupedName(String serviceName, String groupName)
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
public static boolean isServiceNameCompatibilityMode(String serviceName)
serviceName - serviceNamepublic static void checkServiceNameFormat(String combineServiceName)
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@@serviceNamepublic static String getGroupedNameOptional(String serviceName, String groupName)
This method works similar with getGroupedName(java.lang.String, java.lang.String) But not
verify any parameters.
serviceName | groupName | result
serviceA | groupA | groupA@@serviceA
nil | groupA | groupA@@
nil | nil | @@
public static void checkInstanceIsLegal(Instance instance) throws NacosException
Check instance param about keep alive.
heart beat timeout must > heart beat interval ip delete timeout must > heart beat interval
instance - need checked instanceNacosException - if check failed, throw exceptionpublic static void checkInstanceIsEphemeral(Instance instance) throws NacosException
instance - instanceNacosException - NacosExceptionpublic static void batchCheckInstanceIsLegal(List<Instance> instances) throws NacosException
instances - List of instances to be registeredNacosException - Nacospublic static boolean isNumber(String str)
str - a string of digitsCopyright © 2018–2024 Alibaba Group. All rights reserved.