Class ServiceResultFetchDBMethodGenerator

All Implemented Interfaces:
MethodGenerator

public class ServiceResultFetchDBMethodGenerator extends FetchMappedObjectDBMethodGenerator
Generator that creates DB fetch methods for fields where a @service returns a table-backed type. Extends FetchMappedObjectDBMethodGenerator with isRoot() returning false so that the generated method includes resolver key parameters and WHERE clause for batch fetching by PK.
  • Constructor Details

  • Method Details

    • isRoot

      protected boolean isRoot()
      Overrides:
      isRoot in class FetchDBMethodGenerator
    • getHelperMethodCallForNestedField

      protected no.sikt.graphitron.javapoet.CodeBlock getHelperMethodCallForNestedField(ObjectField field, FetchContext context)
      Description copied from class: FetchDBMethodGenerator
      Generates a helper method call for nested record type fields. This base implementation generates the root-level helper method call.
      Overrides:
      getHelperMethodCallForNestedField in class FetchDBMethodGenerator
      Parameters:
      field - The field to generate the helper method call for
      context - The fetch context (unused in base implementation)
      Returns:
      CodeBlock containing the helper method call, or null to use inline generation
    • getSelectBlockForRecord

      protected no.sikt.graphitron.javapoet.CodeBlock getSelectBlockForRecord(ObjectField target, no.sikt.graphitron.javapoet.CodeBlock selectRowBlock, boolean isReferenceResolverField, InputParser parser)
      Description copied from class: FetchMappedObjectDBMethodGenerator
      Determine the select block to use for record types. By default, delegates to a helper method unless the field is a reference resolver field (which uses a correlated subquery). Subclasses can override to always inline the select.
      Overrides:
      getSelectBlockForRecord in class FetchMappedObjectDBMethodGenerator
    • getSpecBuilder

      protected no.sikt.graphitron.javapoet.MethodSpec.Builder getSpecBuilder(ObjectField referenceField, no.sikt.graphitron.javapoet.TypeName refTypeName, InputParser parser)
      Override to exclude input parameters from the DB method signature. Input arguments are passed to the service call, not to the DB query.
      Overrides:
      getSpecBuilder in class FetchDBMethodGenerator
    • generateAll

      public List<no.sikt.graphitron.javapoet.MethodSpec> generateAll()
      Specified by:
      generateAll in interface MethodGenerator
      Overrides:
      generateAll in class FetchMappedObjectDBMethodGenerator
      Returns:
      List of complete javapoet MethodSpec that can be generated for this object.