class UriTemplateUtil {

    public static String expand(String uriTemplatePath,Map<String, String> map){
        // 所有的变量
        List<String> variableNames = getVariableNames(uriTemplatePath);

        Map<String, String> opMap = newLinkedHashMap(variableNames.size());
        // 基于变量 生成对应的 值空map
        for (String variableName : variableNames){
            opMap.put(variableName, null);//如果不设置默认值,那么会抛出异常 java.lang.IllegalArgumentException: Map has no value for 'categoryCode'
        }

        MapUtil.putAllIfNotNull(opMap, map);

        UriTemplate uriTemplate = new UriTemplate(uriTemplatePath);
        URI uri = uriTemplate.expand(opMap);
        return uri.toString();
    }

    private  UriTemplateUtil();

}