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
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.CodeBlockgetSelectCode(GenerationField field, FetchContext context) Methods inherited from class no.sikt.graphitron.generators.db.FetchDBMethodGenerator
createAliasDeclarations, createAliasDeclarations, createMapping, createOrderFieldsBlock, createOrderFieldsDeclarationBlock, createSeekAndLimitBlock, createSelectConditions, createSelectJoins, createSelectJoins, formatWhereContents, generateCorrelatedSubquery, generateForField, generateForField, generateForUnionField, getHelperMethodCallForNestedField, getInitialKey, getInputConditions, getSelectCodeAndFieldSource, getSpecBuilder, inferFieldNamingConvention, wrapInField, wrapInMultisetMethods inherited from class no.sikt.graphitron.generators.abstractions.DBMethodGenerator
getContextParameters, getDefaultSpecBuilder, getMethodParameters, getMethodParametersWithOrderField, iterableWrapTypeMethods inherited from class no.sikt.graphitron.generators.abstractions.AbstractSchemaMethodGenerator
createServiceDependency, declareAllServiceClasses, declareAllServiceClasses, declareAllServiceClassesInAliasSet, getDataFetcherWiring, getDependencyMap, getLocalObject, getLocalTable, getTypeResolverWiring, inferFieldTypeName
-
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.
-
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.
-