NSAmelchev commented on a change in pull request #7648: IGNITE-12857 Put custom objects via REST URL: https://github.com/apache/ignite/pull/7648#discussion_r409876977
########## File path: modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java ########## @@ -1106,6 +1017,139 @@ private boolean credentials(Map<String, Object> params, String userParam, String return null; } + /** */ + private class Converter { + /** Cache name. */ + private final String cacheName; + + /** + * @param cacheName Cache name. + */ + private Converter(String cacheName) { + this.cacheName = cacheName; + } + + /** */ + private Converter() { + this(null); + } + + /** + * Gets and converts values referenced by sequential keys, e.g. {@code key1...keyN}. + * + * @param type Optional value type. + * @param keyPrefix Key prefix, e.g. {@code key} for {@code key1...keyN}. + * @param params Parameters map. + * @return Values. + */ + private List<Object> values(String type, String keyPrefix, + Map<String, String> params) throws IgniteCheckedException { + assert keyPrefix != null; + + List<Object> vals = new LinkedList<>(); + + for (int i = 1; ; i++) { + String key = keyPrefix + i; + + if (params.containsKey(key)) + vals.add(convert(type, params.get(key))); + else + break; + } + + return vals; + } + + /** + * @param type Optional value type. + * @param s String to convert. + * @return Converted value. + * @throws IgniteCheckedException If failed to convert. + */ + private Object convert(String type, String s) throws IgniteCheckedException { + if (F.isEmpty(type) || s == null) Review comment: Can `s` be checked with `F.empty` too? Mark parametr as nullable, please. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services