class VcapServicesStringParser implements Function<String, Config> {

    @Override
    public Config apply(final String systemVcapServices) {
        checkNotNull(systemVcapServices, "system VCAP services string");
        if (systemVcapServices.isEmpty()) {
            return ConfigFactory.empty();
        }

        final Config vcapServicesConfig = tryToParseString(systemVcapServices);
        final Set<Map.Entry<String, ConfigValue>> vcapServicesConfigEntries = vcapServicesConfig.entrySet();

        final Map<String, Object> result = new HashMap<>(vcapServicesConfigEntries.size());
        for (final Map.Entry<String, ConfigValue> serviceConfigEntry : vcapServicesConfigEntries) {
            result.put(serviceConfigEntry.getKey(), convertConfigListToConfigObject(serviceConfigEntry.getValue()));
        }
        return ConfigFactory.parseMap(result);
    }

    private  VcapServicesStringParser();

}