类 NamingUtils

java.lang.Object
com.alibaba.nacos.api.naming.utils.NamingUtils

public class NamingUtils extends Object
NamingUtils.
从以下版本开始:
1.0.0
作者:
nkorange
  • 构造器详细资料

    • NamingUtils

      public NamingUtils()
  • 方法详细资料

    • getGroupedName

      public static String getGroupedName(String serviceName, String groupName)
      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'
    • getServiceName

      public static String getServiceName(String serviceNameWithGroup)
    • getGroupName

      public static String getGroupName(String serviceNameWithGroup)
    • checkServiceNameFormat

      public static void checkServiceNameFormat(String combineServiceName)
      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

      public static String getGroupedNameOptional(String serviceName, String groupName)
      Returns a combined string with serviceName and groupName. Such as 'groupName@@serviceName'

      This method works similar with getGroupedName(java.lang.String, java.lang.String) But not verify any parameters.

      etc:

      serviceName | groupName | result

      serviceA | groupA | groupA@@serviceA

      nil | groupA | groupA@@

      nil | nil | @@

      返回:
      'groupName@@serviceName'
    • checkInstanceIsLegal

      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 instance
      抛出:
      NacosException - if check failed, throw exception