Interface InputInterceptor

All Known Implementing Classes:
LegacyCoercingInputInterceptor

public interface InputInterceptor
This INTERNAL class can be used to intercept input values before they are coerced into runtime values by the ValuesResolver code.

You could use it to observe input values and optionally change them. Perhaps some sort of migration of data needs to happen, and you need to know what data you are getting in type terms. This would help you do that.

If this is present in a GraphQLContext it will be called. By default, it is not present so no calls to it will be made.

There is a performance aspect to using this code. If you take too long to return values then you are going to slow down your system depending on how big your input objects are.

  • Method Details

    • intercept

      Object intercept(@Nullable Object value, @NonNull GraphQLInputType graphQLType, @NonNull GraphQLContext graphqlContext, @NonNull Locale locale)
      This is called with a value that is to be presented to the ValuesResolver code. The values may be scalars, enums and complex input types.
      Parameters:
      value - the input value that can be null
      graphQLType - the input type
      graphqlContext - the graphql context in play
      locale - the locale in play
      Returns:
      a value that may differ from the original value