Class ResolverKeyHelpers
java.lang.Object
no.sikt.graphitron.generators.codebuilding.ResolverKeyHelpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.jooq.Key<?>findKeyForResolverField(GenerationField field, ProcessedSchema processedSchema) Finds the key used in the first step when resolving a resolver fieldstatic 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.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.static TypeNamegetKeyTypeName(org.jooq.Key<?> key) Get the TypeName for the key variable in the DTOstatic CodeBlockgetSelectKeyColumnRow(org.jooq.Key<?> key, String tableName, String aliasVariableName) Returns the select code for the columns of a key.
-
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 forschema- 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 forschema- 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 fieldprocessedSchema- 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 keyaliasVariableName- The variable name for the table alias- Returns:
- Select code for the columns in the key
-
getKeyTypeName
Get the TypeName for the key variable in the DTO- Parameters:
key- The key- Returns:
- TypeName of the key variable
-