class SpringCloudMetadataServiceURLBuilder implements MetadataServiceURLBuilder {

    @Override
    public List<URL> build(ServiceInstance serviceInstance) {
        Map<String, String> metadata = serviceInstance.getMetadata();
        String dubboURLsJSON = metadata.get(METADATA_SERVICE_URLS_PROPERTY_NAME);
        if (StringUtils.isBlank(dubboURLsJSON)) {
            return Collections.emptyList();
        }
        List<String> urlStrings = JSON.parseArray(dubboURLsJSON, String.class);
        return urlStrings.stream().map(URL::valueOf).collect(Collectors.toList());
    }

}