Class InputParameter

java.lang.Object
com.graphql_java_generator.client.request.InputParameter

public class InputParameter
extends java.lang.Object
Contains an input parameter, to be sent to a query (mutation...). It can be either:
    • A hard coded value
      A bind variable, which value must be provided when executing the query
  • Author:
    EtienneSF
    • Method Summary

      Modifier and Type Method Description
      java.lang.String getName()  
      java.lang.Object getValue()  
      java.lang.String getValueForGraphqlQuery​(java.util.Map<java.lang.String,​java.lang.Object> bindVariables)
      Returns the parameter, as it should be written in the GraphQL query.
      static InputParameter newBindParameter​(java.lang.String name, java.lang.String bindParameterName, boolean mandatory)
      Deprecated.
      static InputParameter newBindParameter​(java.lang.String name, java.lang.String bindParameterName, boolean mandatory, graphql.schema.GraphQLScalarType graphQLScalarType)
      Deprecated.
      static InputParameter newHardCodedParameter​(java.lang.String name, java.lang.Object value)
      Deprecated.

      Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Details

      • newBindParameter

        @Deprecated public static InputParameter newBindParameter​(java.lang.String name, java.lang.String bindParameterName, boolean mandatory)
        Deprecated.
        Creates and returns a new instance of InputParameter, which is bound to a bind variable. The value for this bind variable must be provided, when calling the request execution.
        Parameters:
        name -
        bindParameterName -
        mandatory - true if the parameter's value must be defined during request/mutation/subscription execution.
        If mandatory is true and the parameter's value is not provided, a GraphQLRequestExecutionException exception is thrown at execution time
        If mandatory is false and the parameter's value is not provided, this input parameter is not sent to the server
        Returns:
        See Also:
        QueryExecutorImpl#execute(String, ObjectResponse, List, Class)
      • newBindParameter

        @Deprecated public static InputParameter newBindParameter​(java.lang.String name, java.lang.String bindParameterName, boolean mandatory, graphql.schema.GraphQLScalarType graphQLScalarType)
        Deprecated.
        Creates and returns a new instance of InputParameter, which is bound to a bind variable. The value for this bind variable must be provided, when calling the request execution.
        Parameters:
        name -
        bindParameterName -
        mandatory - true if the parameter's value must be defined during request/mutation/subscription execution.
        If mandatory is true and the parameter's value is not provided, a GraphQLRequestExecutionException exception is thrown at execution time
        If mandatory is false and the parameter's value is not provided, this input parameter is not sent to the server
        graphQLScalarType - If this input parameter's type is a GraphQL Custom Scalar, it must be provided. Otherwise, it must be null.
        graphQLScalarType contains the GraphQLScalarType that allows to convert the value to a String that can be written in the GraphQL request, or convert from a String that is found in the GraphQL response. If this type is not a GraphQL Custom Scalar, it must be null.
        Returns:
        See Also:
        QueryExecutorImpl#execute(String, ObjectResponse, List, Class)
      • newHardCodedParameter

        @Deprecated public static InputParameter newHardCodedParameter​(java.lang.String name, java.lang.Object value)
        Deprecated.
        Creates and returns a new instance of InputParameter, which value is given, and can not be changed afterwards
        Parameters:
        name -
        value -
        Returns:
      • getName

        public java.lang.String getName()
      • getValue

        public java.lang.Object getValue()
      • getValueForGraphqlQuery

        public java.lang.String getValueForGraphqlQuery​(java.util.Map<java.lang.String,​java.lang.Object> bindVariables) throws GraphQLRequestExecutionException
        Returns the parameter, as it should be written in the GraphQL query. For instance:
        • String: a "string" -> "a \"string\""
        • Enum: EPISODE -> EPISODE (no escape or double quote here)
        Parameters:
        bindVariables - The map for the bind variables. It may be null, if this input parameter is a hard coded one. If this parameter is a Bind Variable, then bindVariables is mandatory, and it must contain a value for th bind parameter which name is stored in bindParameterName.
        Returns:
        Throws:
        GraphQLRequestExecutionException