Skip to content

Instantly share code, notes, and snippets.

@chibenwa
Last active July 2, 2019 04:20
Show Gist options
  • Select an option

  • Save chibenwa/2333657576169ca8a5e733f59e383d5e to your computer and use it in GitHub Desktop.

Select an option

Save chibenwa/2333657576169ca8a5e733f59e383d5e to your computer and use it in GitHub Desktop.
JMAP Result reference
public class ExecutionContext {
private final HashMap<ClientId, Method.Response> previousResponses;
public void addResponse(ClientId clientId, Method.Response response) {
previousResponses.put(clientId, response);
}
public <T> List<T> retrieveResultReferences(ResultReferencesPath path, Class<T> clazz) {
ClientId callId = path.getMethodCallId();
Method.Response response = Optional.ofNullable(previousResponses.get(callId)).get();
return response.resolve(path, clazz);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment