Class GenerateClientCodeTask
- All Implemented Interfaces:
com.graphql_java_generator.plugin.conf.CommonConfiguration,com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration,com.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration,Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
The generateClientCode Maven goal (and Gradle task) generates the java code from one or more GraphQL schemas. It allows to work in Java with graphQL, in a schema first approach.
It generates a class for each query, mutation and subscription type. These classes contain the methods to call the queries, mutations and subscriptions. That is: to execute a query against the GraphQL server, you just have to call one of these methods. It also generates the POJOs from the GraphQL schema. The GraphQL response is stored in these POJOs, for an easy and standard use in Java.
You'll find more info in the tutorials: take a look at the Maven client tutorial or the Gradle client tutorial
Note: The attribute have no default values: their default values is read from the
GenerateCodeCommonExtension, whose attributes can be either the default value, or a value set in the build
script.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
Fields inherited from class com.graphql_java_generator.gradleplugin.GenerateCodeCommonTask
targetResourceFolder, targetSourceFolder, useJakartaEE9Fields inherited from class com.graphql_java_generator.gradleplugin.CommonTask
extension, skipGenerationIfSchemaHasNotChangedFields inherited from interface com.graphql_java_generator.plugin.conf.CommonConfiguration
DEFAULT_ADD_RELAY_CONNECTIONS, DEFAULT_JSON_GRAPHQL_SCHEMA_FILE, DEFAULT_MAX_TOKENS, DEFAULT_PACKAGE_NAME, DEFAULT_PREFIX, DEFAULT_SCHEMA_FILE_FOLDER, DEFAULT_SCHEMA_FILE_PATTERN, DEFAULT_SCHEMA_SUB_FOLDER, DEFAULT_SKIP_GENERATION_IF_SCHEMA_HAS_NOT_CHANGED, DEFAULT_SUFFIX, DEFAULT_TARGET_SCHEMA_SUBFOLDERFields inherited from interface com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration
DEFAULT_GENERATE_DEPRECATED_REQUEST_RESPONSEFields inherited from interface com.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration
DEFAULT_COPY_RUNTIME_SOURCES, DEFAULT_QUERY_MUTATION_EXECUTION_PROTOCOL, DEFAULT_SCHEMA_PERSONALIZATION_FILE, DEFAULT_SEPARATE_UTIL_CLASSES, DEFAULT_SOURCE_ENCODING, DEFAULT_SPRING_BEAN_SUFFIX, DEFAULT_TARGET_RESOURCE_FOLDER, DEFAULT_TARGET_SOURCE_FOLDER, DEFAULT_USE_JAKARTA_EE9Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()protected GenerateClientCodeExtensioncom.graphql_java_generator.plugin.conf.PluginModegetMode()booleanbooleanfinal voidsetGenerateDeprecatedRequestResponse(boolean generateDeprecatedRequestResponse) Methods inherited from class com.graphql_java_generator.gradleplugin.GenerateCodeCommonTask
getCustomScalars, getPackageName, getQueryMutationExecutionProtocol, getSchemaPersonalizationFile, getSourceEncoding, getSpringAutoConfigurationPackage, getSpringBeanSuffix, getTargetClassFolder, getTargetResourceFolder, getTargetSourceFolder, isCopyRuntimeSources, isGenerateUtilityClasses, isSeparateUtilityClasses, isUseJakartaEE9, setCopyRuntimeSources, setCustomScalars, setPackageName, setQueryMutationExecutionProtocol, setSchemaPersonalizationFile, setSeparateUtilityClasses, setSourceEncoding, setSpringBeanSuffix, setTargetResourceFolder, setTargetSourceFolder, setUseJakartaEE9Methods inherited from class com.graphql_java_generator.gradleplugin.CommonTask
getDefaultTargetSchemaFileName, getEnumPrefix, getEnumSuffix, getFileValue, getInputPrefix, getInputSuffix, getInterfacePrefix, getInterfaceSuffix, getJsonGraphqlSchemaFilename, getMaxTokens, getProjectBuildDir, getProjectDir, getProjectMainSourceFolder, getSchemaFileFolder, getSchemaFilePattern, getTargetSchemaSubFolder, getTemplates, getTypePrefix, getTypeSuffix, getUnionPrefix, getUnionSuffix, getValue, isAddRelayConnections, isInitialized, isSkipGenerationIfSchemaHasNotChanged, logConfiguration, setAddRelayConnections, setEnumPrefix, setEnumSuffix, setExtension, setInitialized, setInputPrefix, setInputSuffix, setInterfacePrefix, setInterfaceSuffix, setJsonGraphqlSchemaFilename, setParserOptions, setSchemaFileFolder, setSchemaFilePattern, setSkipGenerationIfSchemaHasNotChanged, setTargetSchemaSubFolder, setTemplates, setTypePrefix, setTypeSuffix, setUnionPrefix, setUnionSuffixMethods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.graphql_java_generator.plugin.conf.CommonConfiguration
getDefaultTargetSchemaFileName, getEnumPrefix, getEnumSuffix, getInputPrefix, getInputSuffix, getInterfacePrefix, getInterfaceSuffix, getJsonGraphqlSchemaFilename, getMaxTokens, getProjectBuildDir, getProjectDir, getProjectMainSourceFolder, getSchemaFileFolder, getSchemaFilePattern, getTargetSchemaSubFolder, getTemplates, getTypePrefix, getTypeSuffix, getUnionPrefix, getUnionSuffix, isAddRelayConnections, isSkipGenerationIfSchemaHasNotChanged, logCommonConfigurationMethods inherited from interface com.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration
logConfigurationMethods inherited from interface com.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration
getCustomScalars, getPackageName, getQueryMutationExecutionProtocol, getSchemaPersonalizationFile, getSourceEncoding, getSpringAutoConfigurationPackage, getSpringBeanSuffix, getTargetClassFolder, getTargetResourceFolder, getTargetSourceFolder, isCopyRuntimeSources, isGenerateUtilityClasses, isSeparateUtilityClasses, isUseJakartaEE9, logGenerateCodeCommonConfigurationMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
GenerateClientCodeTask
@Inject public GenerateClientCodeTask(org.gradle.api.file.ProjectLayout projectLayout) - Parameters:
projectLayout- This Gradle service is automatically injected by gradle. It allows to retrieve the project directory, as accessing the GradleProjectis forbidden from a task.
-
-
Method Details
-
execute
- Throws:
IOException
-
isGenerateDeprecatedRequestResponse
@Input public boolean isGenerateDeprecatedRequestResponse()- Specified by:
isGenerateDeprecatedRequestResponsein interfacecom.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration
-
setGenerateDeprecatedRequestResponse
public final void setGenerateDeprecatedRequestResponse(boolean generateDeprecatedRequestResponse) -
isGenerateJacksonAnnotations
@Internal public boolean isGenerateJacksonAnnotations()- Specified by:
isGenerateJacksonAnnotationsin interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration- Specified by:
isGenerateJacksonAnnotationsin interfacecom.graphql_java_generator.plugin.conf.GenerateClientCodeConfiguration- Overrides:
isGenerateJacksonAnnotationsin classGenerateCodeCommonTask
-
getExtension
- Overrides:
getExtensionin classGenerateCodeCommonTask
-
getMode
@Input public com.graphql_java_generator.plugin.conf.PluginMode getMode()- Specified by:
getModein interfacecom.graphql_java_generator.plugin.conf.GenerateCodeCommonConfiguration- Overrides:
getModein classGenerateCodeCommonTask
-