Annotation Interface Query


@Target(METHOD) @Retention(RUNTIME) @Documented public @interface Query
Specifies that the annotated method provides the implementation (ie. the resolver) for a GraphQL query.

For example, a user might annotate a method as such:
 public class CharacterService {
     @Query("friendsOf")
     @Description("Returns all the friends of a character")
     public List<Character> getFriendsOf(Character character) {
         //...
     }
 }
 
Schema generation of this would result in a stanza such as:
 type Query {
    "Returns all the friends of a character"
    friendsOf(character: CharacterInput): [Character]
 }
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
  • Element Details

    • value

      String value
      Returns:
      the name to use for the query. If empty, annotated method's name is used.
      Default:
      ""