use of org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher in project sirius-components by eclipse-sirius.
the class IDataFetcherWithFieldCoordinates method getFieldCoordinates.
/**
* The field coordinates that are supported by the data fetcher.
*
* @return The field coordinates
*/
default List<FieldCoordinates> getFieldCoordinates() {
FieldCoordinates fieldCoordinates = null;
QueryDataFetcher queryDataFetcher = this.getClass().getAnnotation(QueryDataFetcher.class);
MutationDataFetcher mutationDataFetcher = this.getClass().getAnnotation(MutationDataFetcher.class);
SubscriptionDataFetcher subscriptionDataFetcher = this.getClass().getAnnotation(SubscriptionDataFetcher.class);
if (queryDataFetcher != null) {
fieldCoordinates = FieldCoordinates.coordinates(queryDataFetcher.type(), queryDataFetcher.field());
} else if (mutationDataFetcher != null) {
fieldCoordinates = FieldCoordinates.coordinates(mutationDataFetcher.type(), mutationDataFetcher.field());
} else if (subscriptionDataFetcher != null) {
fieldCoordinates = FieldCoordinates.coordinates(subscriptionDataFetcher.type(), subscriptionDataFetcher.field());
}
return List.of(fieldCoordinates);
}
Aggregations