Package no.sikt.graphitron.generators.db
Class DBClassGenerator
java.lang.Object
no.sikt.graphitron.generators.abstractions.AbstractClassGenerator
no.sikt.graphitron.generators.abstractions.AbstractSchemaClassGenerator<ObjectDefinition>
no.sikt.graphitron.generators.db.DBClassGenerator
- All Implemented Interfaces:
ClassGenerator
- Direct Known Subclasses:
SelectHelperDBClassGenerator
Class generator that keeps track of all method generators for DB queries.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected final Set<ObjectField> Fields inherited from class no.sikt.graphitron.generators.abstractions.AbstractSchemaClassGenerator
processedSchema -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionno.sikt.graphitron.javapoet.TypeSpecgenerate(ObjectDefinition target) List<no.sikt.graphitron.javapoet.TypeSpec> Generate the classes and return the list of TypeSpecs.no.sikt.graphitron.javapoet.TypeSpec.BuildergetSpec(String className, List<? extends MethodGenerator> generators) protected voidwarnOrCrashIfMethodsExceedsBounds(no.sikt.graphitron.javapoet.TypeSpec typeSpec) voidwriteToFile(no.sikt.graphitron.javapoet.TypeSpec generatedClass, String path, String packagePath, String directoryOverride) Create theJavaFilefor this class, add any common static imports and write it to file.writeToString(no.sikt.graphitron.javapoet.TypeSpec generatedClass) Create theJavaFilefor this class, add any common static imports and render the file as a string.Methods inherited from class no.sikt.graphitron.generators.abstractions.AbstractClassGenerator
generateAllAsMap, generateAllToDirectory, getGeneratedClassName, getSpec, setDependencies, writeToFile
-
Field Details
-
DEFAULT_SAVE_DIRECTORY_NAME
- See Also:
-
FILE_NAME_SUFFIX
- See Also:
-
objectFieldsReturningNode
-
-
Constructor Details
-
DBClassGenerator
-
-
Method Details
-
generateAll
Description copied from interface:ClassGeneratorGenerate the classes and return the list of TypeSpecs. -
generate
- Specified by:
generatein classAbstractSchemaClassGenerator<ObjectDefinition>- Parameters:
target- AGenerationTargetobject representing a source from which a class should be generated.- Returns:
- A complete class in the form of a javapoet
TypeSpec.
-
getDefaultSaveDirectoryName
- Returns:
- The final directory path within the package where the classes are ultimately saved.
-
getSpec
public no.sikt.graphitron.javapoet.TypeSpec.Builder getSpec(String className, List<? extends MethodGenerator> generators) - Specified by:
getSpecin interfaceClassGenerator- Overrides:
getSpecin classAbstractClassGenerator- Parameters:
className- The name of the class.generators- List of method generators that this class should use to generate its methods.- Returns:
- A completed
TypeSpec.Builderfor this class, where all methods have already been added.
-
getStaticImports
-
writeToFile
public void writeToFile(no.sikt.graphitron.javapoet.TypeSpec generatedClass, String path, String packagePath, String directoryOverride) Description copied from interface:ClassGeneratorCreate theJavaFilefor this class, add any common static imports and write it to file.- Specified by:
writeToFilein interfaceClassGenerator- Overrides:
writeToFilein classAbstractClassGenerator- Parameters:
generatedClass- A complete javapoetTypeSpec.path- The path to the output directory.packagePath- The package path that this class should be written to.directoryOverride- Override the directory within the package where the class is saved to.
-
writeToString
Description copied from interface:ClassGeneratorCreate theJavaFilefor this class, add any common static imports and render the file as a string.- Specified by:
writeToStringin interfaceClassGenerator- Overrides:
writeToStringin classAbstractClassGenerator- Parameters:
generatedClass- A complete javapoetTypeSpec.
-
getFileNameSuffix
- Returns:
- The suffix that is to be added to the end of file names generated by this class.
-
warnOrCrashIfMethodsExceedsBounds
protected void warnOrCrashIfMethodsExceedsBounds(no.sikt.graphitron.javapoet.TypeSpec typeSpec)
-