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.StringgetName()java.lang.ObjectgetValue()java.lang.StringgetValueForGraphqlQuery(java.util.Map<java.lang.String,java.lang.Object> bindVariables)Returns the parameter, as it should be written in the GraphQL query.static InputParameternewBindParameter(java.lang.String name, java.lang.String bindParameterName, boolean mandatory)Deprecated.static InputParameternewBindParameter(java.lang.String name, java.lang.String bindParameterName, boolean mandatory, graphql.schema.GraphQLScalarType graphQLScalarType)Deprecated.static InputParameternewHardCodedParameter(java.lang.String name, java.lang.Object value)Deprecated.
-
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 ofInputParameter, 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, aGraphQLRequestExecutionExceptionexception 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 ofInputParameter, 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, aGraphQLRequestExecutionExceptionexception 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 servergraphQLScalarType- If this input parameter's type is a GraphQL Custom Scalar, it must be provided. Otherwise, it must be null.
graphQLScalarType contains theGraphQLScalarTypethat 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 ofInputParameter, 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 GraphQLRequestExecutionExceptionReturns 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 inbindParameterName.- Returns:
- Throws:
GraphQLRequestExecutionException
-