public static void addSortedParams(UriBuilder uriBuilder, DataMap params, ProtocolVersion version)
  {
    if(version.compareTo(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion()) >= 0)
    {
      addSortedParams(uriBuilder, params);
    }
    else
    {
      QueryParamsDataMap.addSortedParams(uriBuilder, params);
    }
  }
@Test
  public void testProjectionMask()
  {
    DataMap queryParams = new DataMap();

    DataMap fields = new DataMap();
    fields.put("name", 1);

    DataMap friends = new DataMap();
    friends.put("$start", 1);
    friends.put("$count", 2);
    fields.put("friends", friends);

    queryParams.put("fields", fields);

    DataMap paramMap = new DataMap();
    paramMap.put("foo", "bar");
    paramMap.put("empty", new DataMap());

    queryParams.put("aParam", paramMap);

    DataList paramList = new DataList();
    paramList.add("x");
    paramList.add("y");
    paramList.add("z");

    queryParams.put("bParam", paramList);

    UriBuilder uriBuilder = new UriBuilder();
    URIParamUtils.addSortedParams(uriBuilder, queryParams);
    URI uri = uriBuilder.build();

    String query = uri.getQuery();
    Assert.assertEquals(query, "aParam=(empty:(),foo:bar)&bParam=List(x,y,z)&fields=name,friends:($start:1,$count:2)");

    String rawQuery = uri.getRawQuery();
    Assert.assertEquals(rawQuery, "aParam=(empty:(),foo:bar)&bParam=List(x,y,z)&fields=name,friends:($start:1,$count:2)");
  }