Class ConfigUtils

java.lang.Object
org.apache.dubbo.common.utils.ConfigUtils

public class ConfigUtils extends Object
  • Method Details

    • isNotEmpty

      public static boolean isNotEmpty(String value)
    • isEmpty

      public static boolean isEmpty(String value)
    • isDefault

      public static boolean isDefault(String value)
    • mergeValues

      public static List<String> mergeValues(ExtensionDirector extensionDirector, Class<?> type, String cfg, List<String> def)
      Insert default extension into extension list.

      Extension list support

      • Special value default, means the location for default extensions.
      • Special symbol-, means remove. -foo1 will remove default extension 'foo'; -default will remove all default extensions.
      Parameters:
      type - Extension type
      cfg - Extension name list
      def - Default extension list
      Returns:
      result extension list
    • replaceProperty

      public static String replaceProperty(String expression, Map<String,String> params)
    • replaceProperty

      public static String replaceProperty(String expression, Configuration configuration)
    • getProperties

      public static Properties getProperties(Set<ClassLoader> classLoaders)
      Get dubbo properties. It is not recommended using this method to modify dubbo properties.
      Returns:
    • getSystemProperty

      public static String getSystemProperty(String key)
      System environment -> System properties
      Parameters:
      key - key
      Returns:
      value
    • loadProperties

      public static Properties loadProperties(Set<ClassLoader> classLoaders, String fileName)
    • loadProperties

      public static Properties loadProperties(Set<ClassLoader> classLoaders, String fileName, boolean allowMultiFile)
    • loadProperties

      public static Properties loadProperties(Set<ClassLoader> classLoaders, String fileName, boolean allowMultiFile, boolean optional)
      Load properties file to Properties from class path.
      Parameters:
      fileName - properties file name. for example: dubbo.properties, METE-INF/conf/foo.properties
      allowMultiFile - if false, throw IllegalStateException when found multi file on the class path.
      optional - is optional. if false, log warn when properties config file not found!s
      Returns:
      loaded Properties content.
      • return empty Properties if no file found.
      • merge multi properties file if found multi file
      Throws:
      IllegalStateException - not allow multi-file, but multi-file exist on class path.
    • loadMigrationRule

      public static String loadMigrationRule(Set<ClassLoader> classLoaders, String fileName)
    • getPid

      public static int getPid()