FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add generic DataFetcherResult.newBuilder(T data) method by jord1e · Pull Request #4254 · graphql-java/graphql-java · GitHub

Add generic DataFetcherResult.newBuilder(T data) method - #4254

Merged
bbakerman merged 2 commits into
graphql-java:masterfrom
jord1e:generic-dfr-builder
Feb 22, 2026
Merged

Add generic DataFetcherResult.newBuilder(T data) method#4254
bbakerman merged 2 commits into
graphql-java:masterfrom
jord1e:generic-dfr-builder

Conversation

jord1e commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

This is something that has always been on my mind, I usually put it in a utility method myself. Would be great if it makes 26.0

It turns:

@MutationMapping
public DataFetcherResult<MyPayload> myField() {
  return DataFetcherResult.<MyPayload>newResult()
      .data(MyPayload.newBuilder().build())
      .localContext(...)
      .build();
}

into

@MutationMapping
public DataFetcherResult<MyPayload> myField() {
  return DataFetcherResult.newResult(MyPayload.newBuilder().build())
      .localContext(...)
      .build();
}

This prevents you from having to write your own generic before newBuilder <>

Thank you for the work as always

jord1e force-pushed the generic-dfr-builder branch from 25ebe08 to bc7e739 Compare February 20, 2026 10:51

bbakerman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Fair enough - thanks

bbakerman merged commit f7a2377 into graphql-java:master Feb 22, 2026
7 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL