Package no.sikt.graphitron.generators.db
Class EntityDBFetcherMethodGenerator
java.lang.Object
no.sikt.graphitron.generators.abstractions.AbstractSchemaMethodGenerator<T,ObjectDefinition>
no.sikt.graphitron.generators.abstractions.DBMethodGenerator<ObjectField>
no.sikt.graphitron.generators.db.FetchDBMethodGenerator
no.sikt.graphitron.generators.db.EntityDBFetcherMethodGenerator
- All Implemented Interfaces:
MethodGenerator
This class generates the queries needed to resolve entities.
-
Field Summary
Fields inherited from class no.sikt.graphitron.generators.db.FetchDBMethodGenerator
conditionsShouldFallbackToFalse, ELEMENT_NAME, isRoot, resolverKeyParamNameFields inherited from class no.sikt.graphitron.generators.abstractions.AbstractSchemaMethodGenerator
dependencyMap, localObject, processedSchema -
Constructor Summary
ConstructorsConstructorDescriptionEntityDBFetcherMethodGenerator(ObjectDefinition localObject, ProcessedSchema processedSchema) -
Method Summary
Modifier and TypeMethodDescriptionprotected no.sikt.graphitron.javapoet.CodeBlockformatWhere(FetchContext context) no.sikt.graphitron.javapoet.MethodSpecgenerate(ObjectField target) List<no.sikt.graphitron.javapoet.MethodSpec>protected no.sikt.graphitron.javapoet.CodeBlockgenerateSelectRow(FetchContext context) This method recursively generates one single row method call.protected no.sikt.graphitron.javapoet.CodeBlockgetHelperMethodCallForNestedField(ObjectField field, FetchContext context) Generates a helper method call for nested record type fields.protected no.sikt.graphitron.javapoet.CodeBlockgetSelectCode(GenerationField field, FetchContext context) Methods inherited from class no.sikt.graphitron.generators.db.FetchDBMethodGenerator
createAliasDeclarations, createAliasDeclarations, createMapping, createOrderFieldsBlock, createOrderFieldsDeclarationBlock, createSeekAndLimitBlock, createSelectConditions, createSelectJoins, createSelectJoins, formatJooqConditions, formatWhereContents, generateCorrelatedSubquery, generateForField, generateForField, generateForUnionField, generateHelperMethodName, generateNestedMethodName, getInitialKey, getInputConditions, getSelectCodeAndFieldSource, getSpecBuilder, inferFieldNamingConvention, wrapInField, wrapInMultisetMethods inherited from class no.sikt.graphitron.generators.abstractions.DBMethodGenerator
getDefaultSpecBuilderMethods inherited from class no.sikt.graphitron.generators.abstractions.AbstractSchemaMethodGenerator
createServiceDependency, declareAllServiceClasses, declareAllServiceClasses, declareAllServiceClassesInAliasSet, getDataFetcherWiring, getDependencyMap, getLocalObject, getLocalTable, getTypeResolverWiring
-
Constructor Details
-
EntityDBFetcherMethodGenerator
public EntityDBFetcherMethodGenerator(ObjectDefinition localObject, ProcessedSchema processedSchema)
-
-
Method Details
-
generate
- Specified by:
generatein classAbstractSchemaMethodGenerator<ObjectField,ObjectDefinition> - Returns:
- The complete javapoet
MethodSpecbased on the provided target.
-
getHelperMethodCallForNestedField
protected no.sikt.graphitron.javapoet.CodeBlock getHelperMethodCallForNestedField(ObjectField field, FetchContext context) Description copied from class:FetchDBMethodGeneratorGenerates a helper method call for nested record type fields. This base implementation generates the root-level helper method call.- Overrides:
getHelperMethodCallForNestedFieldin classFetchDBMethodGenerator- Parameters:
field- The field to generate the helper method call forcontext- The fetch context (unused in base implementation)- Returns:
- CodeBlock containing the helper method call, or null to use inline generation
-
formatWhere
- Returns:
- Formatted CodeBlock for the where-statement and surrounding code. Applies conditions and joins.
-
generateSelectRow
This method recursively generates one single row method call. It deduces how each layer of row call should be structured by keeping track of joins and following field references.- Overrides:
generateSelectRowin classFetchDBMethodGenerator- Returns:
- Code block which contains the entire recursive structure of the row statement.
-
getSelectCode
protected no.sikt.graphitron.javapoet.CodeBlock getSelectCode(GenerationField field, FetchContext context) -
generateAll
- Returns:
- List of complete javapoet
MethodSpecthat can be generated for this object.
-