Class ResolverKeyHelpers

java.lang.Object
no.sikt.graphitron.generators.codebuilding.ResolverKeyHelpers

public class ResolverKeyHelpers extends Object
  • Constructor Details

    • ResolverKeyHelpers

      public ResolverKeyHelpers()
  • Method Details

    • getKeyMapForResolverFields

      public static LinkedHashMap<String,org.jooq.Key<?>> getKeyMapForResolverFields(List<? extends GenerationField> fields, ProcessedSchema schema)
      Get map of field names to keys used in the first step of the reference in resolver fields. The key could either be a foreign key or the primary key of the current table.
      Parameters:
      fields - The fields to find keys for
      schema - The processed schema
      Returns:
      The map of field names and keys
    • getKeySetForResolverFields

      public static LinkedHashSet<org.jooq.Key<?>> getKeySetForResolverFields(List<? extends GenerationField> fields, ProcessedSchema schema)
      Get the set of keys used in the resolver fields given a list of fields. The key could either be a foreign key or the primary key of the current table.
      Parameters:
      fields - The fields to find keys for
      schema - The processed schema
      Returns:
      The map of field names and keys
    • findKeyForResolverField

      public static org.jooq.Key<?> findKeyForResolverField(GenerationField field, ProcessedSchema processedSchema)
      Finds the key used in the first step when resolving a resolver field
      Parameters:
      field - The resolver field
      processedSchema - The processed schema
      Returns:
      The key used in the first step when resolving a resolver field
    • getSelectKeyColumnRow

      public static CodeBlock getSelectKeyColumnRow(org.jooq.Key<?> key, String tableName, String aliasVariableName)
      Returns the select code for the columns of a key.
      Parameters:
      key - The key
      aliasVariableName - The variable name for the table alias
      Returns:
      Select code for the columns in the key
    • getKeyTypeName

      public static TypeName getKeyTypeName(org.jooq.Key<?> key)
      Get the TypeName for the key variable in the DTO
      Parameters:
      key - The key
      Returns:
      TypeName of the key variable