Annotation Type GraphQLContext


@Documented
@Retention(RUNTIME)
@Target({PARAMETER,FIELD,ANNOTATION_TYPE})
public @interface GraphQLContext
Annotation that can be used on a parameter within a method annotated with GraphQLField to access something stored in the global context for the current execution. The use of this annotation assumes that the global context has been set up to be an instance of GraphQLContext.

 @GraphQLField
 public String list(@GraphQLContext("Auth") AuthData auth) {
 }
 

This annotation can be placed on another annotation to allow that annotation to be used instead when injecting a parameter or a field:

 @GraphQLContext("Auth")
 @Retention(RetentionPolicy.RUNTIME)
 @Target({ ElementType.PARAMETER, ElementType.FIELD })
 public @interface AuthContext {
 }
 

 @GraphQLField
 public String list(@AuthContext AuthData auth) {
 }
 
  • Required Element Summary

    Required Elements 
    Modifier and Type Required Element Description
    String value
    The context key to get.
  • Element Details