![JAR search and dependency download from the Maven repository](/logo.png)
com.tvd12.ezyhttp.server.graphql.GraphQLDataFetcher Maven / Gradle / Ivy
The newest version!
package com.tvd12.ezyhttp.server.graphql;
import com.tvd12.ezyfox.exception.EzyNotImplementedException;
import com.tvd12.ezyfox.reflect.EzyGenerics;
import com.tvd12.ezyhttp.server.graphql.annotation.GraphQLQuery;
public interface GraphQLDataFetcher {
D getData(A argument);
default String getQueryName() {
if (getClass().isAnnotationPresent(GraphQLQuery.class)) {
return getClass().getAnnotation(GraphQLQuery.class).name();
}
throw new EzyNotImplementedException("you must implement " +
getClass().getName() +
".getQueryName() method or annotated the class with @GraphQLQuery"
);
}
default Class> getArgumentType() {
try {
Class> readerClass = getClass();
Class>[] args = EzyGenerics.getGenericInterfacesArguments(
readerClass,
GraphQLDataFetcher.class,
2
);
return args[0];
} catch (Exception e) {
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy