Search in sources :

Example 1 with QueryDataFetcher

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);
}
Also used : QueryDataFetcher(org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher) FieldCoordinates(graphql.schema.FieldCoordinates) SubscriptionDataFetcher(org.eclipse.sirius.components.annotations.spring.graphql.SubscriptionDataFetcher) MutationDataFetcher(org.eclipse.sirius.components.annotations.spring.graphql.MutationDataFetcher)

Aggregations

FieldCoordinates (graphql.schema.FieldCoordinates)1 MutationDataFetcher (org.eclipse.sirius.components.annotations.spring.graphql.MutationDataFetcher)1 QueryDataFetcher (org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher)1 SubscriptionDataFetcher (org.eclipse.sirius.components.annotations.spring.graphql.SubscriptionDataFetcher)1