类 ConfigurationUtils


  • public class ConfigurationUtils
    extends Object
    Utilities for manipulating configurations from different sources
    • 构造器详细资料

      • ConfigurationUtils

        public ConfigurationUtils()
    • 方法详细资料

      • getSystemConfiguration

        public static Configuration getSystemConfiguration()
        Used to get properties from the jvm
        返回:
      • getEnvConfiguration

        public static Configuration getEnvConfiguration()
        Used to get properties from the os environment
        返回:
      • getDynamicGlobalConfiguration

        public static Configuration getDynamicGlobalConfiguration()
      • getServerShutdownTimeout

        public static int getServerShutdownTimeout()
      • getCachedDynamicProperty

        public static String getCachedDynamicProperty​(String key,
                                                      String defaultValue)
      • getDynamicProperty

        public static String getDynamicProperty​(String property)
      • getDynamicProperty

        public static String getDynamicProperty​(String property,
                                                String defaultValue)
      • getProperty

        public static String getProperty​(String property)
      • getProperty

        public static String getProperty​(String property,
                                         String defaultValue)
      • get

        public static int get​(String property,
                              int defaultValue)
      • isEmptyValue

        public static boolean isEmptyValue​(Object value)
      • getSubProperties

        public static <V> Map<String,​V> getSubProperties​(Collection<Map<String,​V>> configMaps,
                                                               String prefix)
        Search props and extract sub properties.
         # properties
         dubbo.protocol.name=dubbo
         dubbo.protocol.port=1234
        
         # extract protocol props
         Map props = getSubProperties("dubbo.protocol.");
        
         # result
         props: {"name": "dubbo", "port" : "1234"}
        
         
        类型参数:
        V -
        参数:
        configMaps -
        prefix -
        返回:
      • hasSubProperties

        public static <V> boolean hasSubProperties​(Collection<Map<String,​V>> configMaps,
                                                   String prefix)
      • getSubIds

        public static <V> Set<String> getSubIds​(Collection<Map<String,​V>> configMaps,
                                                String prefix)
        Search props and extract config ids
         # properties
         dubbo.registries.registry1.address=xxx
         dubbo.registries.registry2.port=xxx
        
         # extract ids
         Set configIds = getSubIds("dubbo.registries.")
        
         # result
         configIds: ["registry1", "registry2"]
         
        参数:
        configMaps -
        prefix -
        返回: