Class AbstractSchemaMethodGenerator<T extends GenerationTarget,U extends GenerationTarget>

java.lang.Object
no.sikt.graphitron.generators.abstractions.AbstractSchemaMethodGenerator<T,U>
All Implemented Interfaces:
MethodGenerator
Direct Known Subclasses:
AbstractMapperMethodGenerator, DBMethodGenerator, ResolverMethodGenerator, TransformerMethodGenerator, TypeNameMethodGenerator, TypeResolverMethodGenerator

public abstract class AbstractSchemaMethodGenerator<T extends GenerationTarget,U extends GenerationTarget> extends Object implements MethodGenerator
An abstract generator that contains methods that are common between both DB-method generators and resolver generators.
  • Field Details

  • Constructor Details

    • AbstractSchemaMethodGenerator

      public AbstractSchemaMethodGenerator(U localObject, ProcessedSchema processedSchema)
  • Method Details

    • getLocalObject

      public U getLocalObject()
      Returns:
      The object that this generator is attempting to build methods for.
    • getLocalTable

      protected JOOQMapping getLocalTable()
    • getDefaultSpecBuilder

      public MethodSpec.Builder getDefaultSpecBuilder(String methodName, TypeName returnType)
      Parameters:
      methodName - The name of the method.
      returnType - The return type of the method, as a javapoet TypeName.
      Returns:
      The default builder for this class' methods, with any common settings applied.
    • getDependencyMap

      public Map<String,List<Dependency>> getDependencyMap()
      Specified by:
      getDependencyMap in interface MethodGenerator
      Returns:
      A set containing all dependencies necessary for these generated methods. Key is the method name where the dependency is needed.
    • iterableWrapType

      protected TypeName iterableWrapType(GenerationField field)
      Returns:
      Get the javapoet TypeName for this field's type, and wrap it in a list ParameterizedTypeName if it is iterable.
    • inferFieldTypeName

      protected TypeName inferFieldTypeName(GenerationField field, boolean checkRecordReferences)
      Returns:
      Get the javapoet TypeName for this field's type.
    • getDataFetcherWiring

      public List<WiringContainer> getDataFetcherWiring()
      Returns:
      Any DataFetcher wiring this generator produces.
    • getTypeResolverWiring

      public List<WiringContainer> getTypeResolverWiring()
      Returns:
      Any TypeRespolver wiring this generator produces.
    • generate

      public abstract MethodSpec generate(T target)
      Returns:
      The complete javapoet MethodSpec based on the provided target.