Class ValuesResolver


  • public class ValuesResolver
    extends java.lang.Object
    • Method Detail

      • getNormalizedVariableValues

        public static java.util.Map<java.lang.String,​NormalizedInputValue> getNormalizedVariableValues​(GraphQLSchema schema,
                                                                                                             java.util.List<VariableDefinition> variableDefinitions,
                                                                                                             RawVariables rawVariables,
                                                                                                             GraphQLContext graphqlContext,
                                                                                                             java.util.Locale locale)
        Normalized variables values are Literals with type information. No validation here!
        Parameters:
        schema - the schema to use
        variableDefinitions - the list of variable definitions
        rawVariables - the raw variables
        graphqlContext - the GraphqlContext to use
        locale - the Locale to use
        Returns:
        a map of the normalised values
      • getArgumentValues

        public static java.util.Map<java.lang.String,​java.lang.Object> getArgumentValues​(java.util.List<GraphQLArgument> argumentTypes,
                                                                                               java.util.List<Argument> arguments,
                                                                                               CoercedVariables coercedVariables,
                                                                                               GraphQLContext graphqlContext,
                                                                                               java.util.Locale locale)
        This is not used for validation: the argument literals are all validated and the variables are validated (when coerced)
        Parameters:
        argumentTypes - the list of argument types
        arguments - the AST arguments
        coercedVariables - the coerced variables
        graphqlContext - the GraphqlContext to use
        locale - the Locale to use
        Returns:
        a map of named argument values
      • getNormalizedArgumentValues

        public static java.util.Map<java.lang.String,​NormalizedInputValue> getNormalizedArgumentValues​(java.util.List<GraphQLArgument> argumentTypes,
                                                                                                             java.util.List<Argument> arguments,
                                                                                                             java.util.Map<java.lang.String,​NormalizedInputValue> normalizedVariables)
        No validation as the arguments are assumed valid
        Parameters:
        argumentTypes - the list of argument types
        arguments - the AST arguments
        normalizedVariables - the normalised variables
        Returns:
        a map of named normalised values
      • valueToLiteral

        public static Value<?> valueToLiteral​(@NotNull
                                              @NotNull GraphqlFieldVisibility fieldVisibility,
                                              @NotNull
                                              @NotNull InputValueWithState inputValueWithState,
                                              @NotNull
                                              @NotNull GraphQLType type,
                                              GraphQLContext graphqlContext,
                                              java.util.Locale locale)
        Takes a value which can be in different states (internal, literal, external value) and converts into Literal

        This assumes the value is valid!

        Parameters:
        fieldVisibility - the field visibility to use
        inputValueWithState - the input value
        type - the type of input value
        graphqlContext - the GraphqlContext to use
        locale - the Locale to use
        Returns:
        a value converted to a literal
      • externalValueToInternalValue

        public static java.lang.Object externalValueToInternalValue​(GraphqlFieldVisibility fieldVisibility,
                                                                    java.lang.Object externalValue,
                                                                    GraphQLInputType type,
                                                                    GraphQLContext graphqlContext,
                                                                    java.util.Locale locale)
        Converts an external value to an internal value
        Parameters:
        fieldVisibility - the field visibility to use
        externalValue - the input external value
        type - the type of input value
        graphqlContext - the GraphqlContext to use
        locale - the Locale to use
        Returns:
        a value converted to an internal value