Interface InputInterceptor


  • 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 Detail

      • intercept

        java.lang.Object intercept​(@Nullable
                                   @Nullable java.lang.Object value,
                                   @NotNull
                                   @NotNull GraphQLInputType graphQLType,
                                   @NotNull
                                   @NotNull GraphQLContext graphqlContext,
                                   @NotNull
                                   @NotNull java.util.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