Extract a map of the property values starting with the given prefix

@param configPrefix  prefix
@param propertiesMap input

@return map
335164
private Map<String, String> subPropertyMap(String configPrefix, Map propertiesMap) {
        Map<String, String> config = new HashMap<String, String>();
        for (Object o : propertiesMap.keySet()) {
            String key = (String) o;
            if (key.startsWith(configPrefix)) {
                String conf = key.substring(configPrefix.length());
                config.put(conf, propertiesMap.get(key).toString());
            }
        }
        return config;
    }
945095
public static Map<String, String> mergeDefaults(
        CmsObject cms,
        Map<String, CmsXmlContentProperty> propertyConfig,
        Map<String, String> properties) {

        Map<String, String> result = new HashMap<String, String>();
        if (propertyConfig != null) {
            for (Map.Entry<String, CmsXmlContentProperty> entry : propertyConfig.entrySet()) {
                CmsXmlContentProperty prop = entry.getValue();
                String value = getPropValueIds(cms, prop.getType(), prop.getDefault());
                if (value != null) {
                    result.put(entry.getKey(), value);
                }
            }
        }
        result.putAll(properties);
        return result;
    }
720317
private Map<String, Object> extractOptions(Map<String, Object> props) {
        List<Map<String, Object>> optionsList = Nester.nest("options", props);
        if (!optionsList.isEmpty()) {
            Map<String, Object> options = new HashMap<String, Object>(optionsList.get(0).size());
            for (Map.Entry<String, Object> option : optionsList.get(0).entrySet()) {
                String key = option.getKey();
                if (key.startsWith(".")
                    || key.startsWith("config.")
                    || key.startsWith("service.")
                    || key.equals("id")) {
                    continue;
                }
                options.put(key, option.getValue());

            }
            return options;
        }
        return new HashMap<String, Object>(2);

    }
1016308
public static Properties getSubProperties (
        Properties source, String prefix, String defaultsPrefix)
    {
        // first load up the defaults
        Properties defs = new Properties();
        extractSubProperties(source, defs, defaultsPrefix);

        // now load up the desired properties
        Properties dest = new Properties(defs);
        extractSubProperties(source, dest, prefix);

        return dest;
    }
751487
private Map<String, String> expandConfig(Map<String, String> map) {
        return expandAllProperties(map, getPropertyLookup().getPropertiesMap());
    }
260432
static Map<String, JDBConnection> connectionMapFromConfig(Config config) throws InitializationException {

      final Config globalPropertyConfig;
      if(config.hasPath("acp.property")) {
         globalPropertyConfig = config.getObject("acp.property").toConfig();
      } else if(config.hasPath("property")) {
         globalPropertyConfig = config.getObject("property").toConfig();
      } else {
         globalPropertyConfig = null;
      }


      final Config connectionsConfig;
      if(config.hasPath("acp.connection")) {
         connectionsConfig = config.getObject("acp.connection").toConfig();
      } else if(config.hasPath("connection")) {
         connectionsConfig = config.getObject("connection").toConfig();
      } else {
         return Collections.emptyMap();
      }

      Map<String, JDBConnection> connectionMap = Maps.newLinkedHashMap();

      for(String connectionName : uniquePrefixSet(connectionsConfig)) {
         Config connectionConfig = connectionsConfig.getObject(connectionName).toConfig();
         connectionMap.put(connectionName, createConnection(connectionName, connectionConfig, globalPropertyConfig));
      }

      return connectionMap;
   }
488215
private static void writeConfig(String prefix, Config config, Properties properties) {
        for (String key : new TreeSet<>(config.keySet())) {
            Object value = config.get(key);

            String entryKey = makeKey(prefix, key);
            if (value instanceof Collection) {
                writeCollection(entryKey, (Collection) value, properties);
            } else {
                properties.setProperty(entryKey, asString(value));
            }
        }
    }
837
private static <E> SortedMap<PrefixKey, E> getPrefixSubMap(
      TreeMap<PrefixKey, E> map, PrefixKey lowerBound) {
    PrefixKey upperBound =
        new PrefixKey(lowerBound.getBucket(), lowerBound.getObjectName() + Character.MAX_VALUE);
    return map.subMap(lowerBound, upperBound);
  }
1169622
VariableMap getPropertyMap() {
    ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
    for (Property p : propertyMap.values()) {
      if (p.newName != null) {
        map.put(p.oldName, p.newName);
      }
    }
    return new VariableMap(map.build());
  }
1205339
public static Map<String, I_CmsFormField> createFields(Collection<CmsXmlContentProperty> propertyConfigurations) {

        // using LinkedHashMap to preserve the order
        Map<String, I_CmsFormField> result = new LinkedHashMap<String, I_CmsFormField>();
        for (CmsXmlContentProperty propConfig : propertyConfigurations) {
            CmsBasicFormField field = createField(propConfig);
            result.put(propConfig.getName(), field);
        }
        return result;

    }
67653
public java.util.Map<java.lang.String, alluxio.grpc.ConfigProperties> getPathConfigsMap() {
    return internalGetPathConfigs().getMap();
  }
828737
public static PrefixedProperties createCascadingPrefixProperties(final String prefixString) {
		return prefixString.indexOf(PrefixConfig.PREFIXDELIMITER) != -1
				? createCascadingPrefixProperties(prefixString.split("\\" + PrefixConfig.PREFIXDELIMITER))
				: createCascadingPrefixProperties(new String[] { prefixString });

	}
671116
static Map<String,String> loadPropertiesMap(InputStream s) throws IOException {
        final Map<String, String> ordered = new LinkedHashMap<>();
        //Hack to use properties class to parse but our map for preserved order
        Properties bp = new Properties() {
            @Override
            public synchronized Object put(Object key, Object value) {
                ordered.put((String)key, (String)value);
                return super.put(key, value);
            }
        };
        bp.load(s);

        final Pattern propertyRegex = Pattern.compile(Pattern.quote("${") + "[^" + Pattern.quote("{[()]}") + "]*" + Pattern.quote("}"));

        final Map<String, String> resolved = new LinkedHashMap<>(ordered.size());

        for (String k : ordered.keySet()) {
            String value = ordered.get(k);

            Matcher matcher = propertyRegex.matcher(value);

            // cycles would loop indefinitely here :-|
            while (matcher.find()) {
                int start = matcher.start(0);
                int end = matcher.end(0);
                String subKey = value.substring(start + 2, end - 1);
                String subValue = resolved.get(subKey);
                if (subValue == null)
                    subValue = System.getProperty(subKey);
                value = value.substring(0, start) + subValue + value.substring(end);
            }

            resolved.put(k, value);
        }
        return resolved;
    }
624664
private <T extends AnnotatedElement> Map<T, PropertyInfo> resolveProperty(String keyPrefix, T element) {
        Map<T, PropertyInfo> result = new HashMap<>();
        if (!shouldDecorate(element)) {
            return result;
        }

        String key = getKey(keyPrefix, element);
        String defaultValue = getPropertyDefaultValue(element);
        String stringValue = compiled.getProperty(key, defaultValue);

        if (stringValue == null) {
            checkRequired(key, element);
            return result;
        }

        Object value = convertValue(element, stringValue);
        result.put(element, new PropertyInfo(key, stringValue, value));
        return result;
    }
803015
public static String getPropertyRelativeSuffix(String prefix, String str) {

        String realPrefix = prefix + ".";
        if (str.startsWith(realPrefix)) {
            return str.substring(realPrefix.length());
        }
        return null;
    }
706402
public Map<String, Class<?>> getPayloadPropertyNames(Map<String,Class<?>> mapPropertyNames)
    {
        mapPropertyNames = super.getPayloadPropertyNames(mapPropertyNames);
        if ((this.getKeyInformation() & STANDARD_PARAM) != 0)
        {   // Add this name and class to the map of property names
            if (mapPropertyNames == null)
                mapPropertyNames = new HashMap<String, Class<?>>();
            mapPropertyNames.put(this.getFullKey(null), this.getRawClassType());
        }
        return mapPropertyNames;
    }
630204
public static Map<TileRef, ColorRgba> imports(Media configMinimap)
    {
        Check.notNull(configMinimap);

        final Map<TileRef, ColorRgba> colors = new HashMap<>();
        final Xml nodeMinimap = new Xml(configMinimap);

        for (final Xml nodeColor : nodeMinimap.getChildren(NODE_COLOR))
        {
            final ColorRgba color = new ColorRgba(nodeColor.readInteger(ATT_COLOR_RED),
                                                  nodeColor.readInteger(ATT_COLOR_GREEN),
                                                  nodeColor.readInteger(ATT_COLOR_BLUE));

            for (final Xml nodeTileRef : nodeColor.getChildren(TileConfig.NODE_TILE))
            {
                final TileRef tileRef = TileConfig.imports(nodeTileRef);
                colors.put(tileRef, color);
            }
        }

        return colors;
    }