Class OperationModel
java.lang.Object
io.smallrye.graphql.client.model.helper.OperationModel
- All Implemented Interfaces:
NamedElement
Represents a model for a GraphQL operation method, providing methods to generate GraphQL query fields,
handle parameter bindings, and extract operation-related information.
- Author:
- mskacelik
-
Method Summary
Modifier and TypeMethodDescriptionbind(ParameterModel parameter) Binds a GraphQL parameter for the specifiedParameterModel.declare(ParameterModel parameter) Declares a GraphQL parameter for the specifiedParameterModel.field(FieldModel field) Generates the GraphQL representation of a field based on the providedFieldModel.Generates GraphQL query fields for the specifiedTypeModel.Gets the location of directives associated with this NamedElement.Gets the list of directives associated with the NamedElement.Gets the key for identifying the GraphQL operation method.getName()Gets the name of the NamedElement, considering anyNameannotation if present.Gets the operation type of the GraphQL operation.Gets the string representation of the operation type (query, mutation, or subscription).Gets the raw (original) name of the NamedElement.Gets the return type of the GraphQL operation.booleanChecks if the NamedElement has associated directives.booleanChecks if the GraphQL operation has root-level parameters.booleanChecks if the GraphQL operation has value parameters.booleanisSingle()Checks if the GraphQL operation returns a single result (one GraphQL operation).Gets the name of the GraphQL mutation, considering anyMutationannotation.Retrieves the prefix for nested expressions in GraphQL queries.nestedParameters(String path) Retrieves the list of parameters representing nested parameters for the GraphQL operation.static OperationModelof(org.jboss.jandex.MethodInfo method) Creates and returns a newOperationModelinstance based on the provided JandexMethodInfo.Gets the name of the GraphQL operation, considering anyQueryorNameannotations.Generates GraphQL query fields for the specifiedTypeModelwith recursion checking.Retrieves the list of parameters representing the root-level parameters for the GraphQL operation.Gets the name of the GraphQL subscription, considering any io.smallrye.graphql.api.Subscription annotation.Retrieves the list of parameters representing the values for the GraphQL operation.
-
Method Details
-
of
Creates and returns a newOperationModelinstance based on the provided JandexMethodInfo.- Parameters:
method- The JandexMethodInforepresenting the GraphQL operation method.- Returns:
- A new
OperationModelinstance.
-
fields
Generates GraphQL query fields for the specifiedTypeModel.- Parameters:
type- TheTypeModelfor which to generate GraphQL query fields.- Returns:
- The generated GraphQL query fields.
- Throws:
IllegalStateException- If a field recursion is detected.
-
recursionCheckedFields
Generates GraphQL query fields for the specifiedTypeModelwith recursion checking.- Parameters:
type- TheTypeModelfor which to generate GraphQL query fields.- Returns:
- The generated GraphQL query fields.
-
field
Generates the GraphQL representation of a field based on the providedFieldModel.- Parameters:
field- TheFieldModelrepresenting the field.- Returns:
- The GraphQL representation of the field.
-
declare
Declares a GraphQL parameter for the specifiedParameterModel.- Parameters:
parameter- TheParameterModelfor which to declare the GraphQL parameter.- Returns:
- The GraphQL declaration of the parameter.
-
bind
Binds a GraphQL parameter for the specifiedParameterModel.- Parameters:
parameter- TheParameterModelfor which to bind the GraphQL parameter.- Returns:
- The GraphQL binding of the parameter.
-
nestedExpressionPrefix
Retrieves the prefix for nested expressions in GraphQL queries.- Returns:
- The prefix for nested expressions.
-
getOperationType
Gets the operation type of the GraphQL operation.- Returns:
- The
OperationTypeof the GraphQL operation.
-
queryName
Gets the name of the GraphQL operation, considering anyQueryorNameannotations.- Returns:
- An optional containing the operation name if specified, otherwise empty.
-
mutationName
Gets the name of the GraphQL mutation, considering anyMutationannotation.- Returns:
- An optional containing the mutation name if specified, otherwise empty.
-
subscriptionName
Gets the name of the GraphQL subscription, considering any io.smallrye.graphql.api.Subscription annotation.- Returns:
- An optional containing the subscription name if specified, otherwise empty.
-
getName
Description copied from interface:NamedElementGets the name of the NamedElement, considering anyNameannotation if present.- Specified by:
getNamein interfaceNamedElement- Returns:
- The field name.
-
getRawName
Description copied from interface:NamedElementGets the raw (original) name of the NamedElement.- Specified by:
getRawNamein interfaceNamedElement- Returns:
- The raw field name.
-
getDirectiveLocation
Description copied from interface:NamedElementGets the location of directives associated with this NamedElement.- Specified by:
getDirectiveLocationin interfaceNamedElement- Returns:
- The directive location
-
hasDirectives
public boolean hasDirectives()Description copied from interface:NamedElementChecks if the NamedElement has associated directives.- Specified by:
hasDirectivesin interfaceNamedElement- Returns:
trueif the NamedElement has directives, otherwisefalse.
-
getDirectives
Description copied from interface:NamedElementGets the list of directives associated with the NamedElement.- Specified by:
getDirectivesin interfaceNamedElement- Returns:
- The list of
DirectiveInstanceobjects.
-
valueParameters
Retrieves the list of parameters representing the values for the GraphQL operation.- Returns:
- The list of value parameters.
-
rootParameters
Retrieves the list of parameters representing the root-level parameters for the GraphQL operation.- Returns:
- The list of root parameters.
-
nestedParameters
Retrieves the list of parameters representing nested parameters for the GraphQL operation.- Parameters:
path- The path for which nested parameters are retrieved.- Returns:
- The list of nested parameters.
-
getReturnType
Gets the return type of the GraphQL operation.- Returns:
- The
TypeModelrepresenting the return type.
-
hasValueParameters
public boolean hasValueParameters()Checks if the GraphQL operation has value parameters.- Returns:
trueif the operation has value parameters, otherwisefalse.
-
hasRootParameters
public boolean hasRootParameters()Checks if the GraphQL operation has root-level parameters.- Returns:
trueif the operation has root parameters, otherwisefalse.
-
isSingle
public boolean isSingle()Checks if the GraphQL operation returns a single result (one GraphQL operation).- Returns:
trueif the operation returns a single result, otherwisefalse.
-
getMethodKey
Gets the key for identifying the GraphQL operation method.- Returns:
- The
MethodKeyrepresenting the key for the operation method (name, parameters types).
-
getOperationTypeAsString
Gets the string representation of the operation type (query, mutation, or subscription).- Returns:
- The string representation of the operation type.
-
getNamespaces
-
getOperationName
-