Ejemplo n.º 1
0
  /**
   * Converts a String -> Object based representation of query params into a {@link DataMap}
   *
   * @param queryParams
   * @param queryParamClasses
   * @param version
   * @return
   */
  public static DataMap convertToDataMap(
      Map<String, Object> queryParams,
      Map<String, Class<?>> queryParamClasses,
      ProtocolVersion version) {
    DataMap result = new DataMap(queryParams.size());
    for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
      String key = entry.getKey();
      Object value = entry.getValue();

      if (RestConstants.PROJECTION_PARAMETERS.contains(key)) {
        @SuppressWarnings("unchecked")
        List<PathSpec> pathSpecs = (List<PathSpec>) value;
        result.put(key, MaskCreator.createPositiveMask(pathSpecs).getDataMap());
      } else {
        result.put(key, paramToDataObject(value, queryParamClasses.get(key), version));
      }
    }
    result.makeReadOnly();
    return result;
  }
Ejemplo n.º 2
0
 static {
   EMPTY_DATAMAP.makeReadOnly();
 }