@Retention(CLASS) @Target({TYPE})

public @interface GraphQLClient

Marks an interface as a GraphQL client that the build-time annotation processor wires up to a generated implementation. Each abstract method carries one of Query, Mutation or Subscription holding the GraphQL operation document, zero or more Var-annotated parameters supplying its variables, an optional @Header("Authorization") String bearer token, and a trailing callback:

  • OnComplete<GraphQLResponse<T>> for Query / Mutation;
  • GraphQLSubscription.Handler<T> for Subscription, in which case the method returns a GraphQLSubscription handle.

The processor emits a <SimpleName>Impl class and registers it with GraphQLClients so the interface’s static T of(String endpoint) factory can return an instance without the project source referencing the impl directly. Mirrors RestClient and GrpcClient.

Methods

public abstract String value() default ""Optional default GraphQL endpoint URL baked into the generated of() factory’s documentation.

Method details

value

public abstract String value() default ""
Optional default GraphQL endpoint URL baked into the generated of() factory’s documentation. The effective endpoint is the argument passed to of(String endpoint); this value is purely informational and may be left empty.