Annotation Interface ContextValue


@Target(PARAMETER) @Retention(RUNTIME) @Documented public @interface ContextValue
Annotation to bind a method parameter to an attribute from the main GraphQLContext.

To bind to an attribute from the local context instead, see @LocalContextValue.

Since:
1.0.0
Author:
Rossen Stoyanchev
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name of the value to bind to.
    boolean
    Whether the value is required.
    Alias for name().
  • Element Details

    • value

      @AliasFor("name") String value
      Alias for name().
      Default:
      ""
    • name

      @AliasFor("value") String name
      The name of the value to bind to.
      Default:
      ""
    • required

      boolean required
      Whether the value is required.

      Defaults to "true", leading to an exception thrown if the value is missing. Switch to "false" if you prefer null if the value is not present, or use Optional.

      Default:
      true