leventov commented on a change in pull request #8157: Enum of ResponseContext keys URL: https://github.com/apache/incubator-druid/pull/8157#discussion_r307377423
########## File path: processing/src/main/java/org/apache/druid/query/context/ResponseContext.java ########## @@ -76,56 +138,128 @@ public static ResponseContext createEmpty() return DefaultResponseContext.createEmpty(); } - protected abstract Map<String, Object> getDelegate(); - - public Object put(String key, Object value) + public static ResponseContext deserialize(String responseContext, ObjectMapper objectMapper) throws IOException { - return getDelegate().put(key, value); + final Map<String, Object> delegate = objectMapper.readValue( + responseContext, + JacksonUtils.TYPE_REFERENCE_MAP_STRING_OBJECT + ); + return new ResponseContext() + { + @Override + protected Map<String, Object> getDelegate() + { + return delegate; + } + }; } - public Object get(String key) + protected abstract Map<String, Object> getDelegate(); Review comment: Please add a Javadoc comment explaining why the keys should still be Strings rather than Keys. (Or change, if they don't.) ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org