Skip to content

Commit 187d1b5

Browse files
committed
Changed the dataFetcher to be with wildcard
1 parent 9f92ee6 commit 187d1b5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/graphql/annotations/connection/ConnectionDataFetcher.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@
2525
import static graphql.annotations.ReflectionKit.constructNewInstance;
2626

2727
public class ConnectionDataFetcher<T> implements DataFetcher<Connection<T>> {
28-
private final Class<? extends ConnectionFetcher<T>> connection;
29-
private final DataFetcher<PaginatedData<T>> actualDataFetcher;
28+
private final DataFetcher<?> actualDataFetcher;
3029
private final Constructor<ConnectionFetcher<T>> constructor;
3130

32-
public ConnectionDataFetcher(Class<? extends ConnectionFetcher<T>> connection, DataFetcher<T> actualDataFetcher) {
33-
this.connection = connection;
34-
this.actualDataFetcher = (DataFetcher<PaginatedData<T>>) actualDataFetcher;
31+
@SuppressWarnings("unchecked")
32+
public ConnectionDataFetcher(Class<? extends ConnectionFetcher<T>> connection, DataFetcher<?> actualDataFetcher) {
33+
this.actualDataFetcher = actualDataFetcher;
3534
Optional<Constructor<ConnectionFetcher<T>>> constructor =
36-
Arrays.stream(this.connection.getConstructors()).
35+
Arrays.stream(connection.getConstructors()).
3736
filter(c -> c.getParameterCount() == 1).
3837
map(c -> (Constructor<ConnectionFetcher<T>>) c).
3938
findFirst();

0 commit comments

Comments
 (0)