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
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 TypeMethodDescriptiongenerate(ObjectDefinition target) Generate the classes and return the list of TypeSpecs.getSpec(String className, List<? extends MethodGenerator> generators) voidwriteToFile(TypeSpec generatedClass, String path, String packagePath, String directoryOverride) Create theJavaFilefor this class, add any common static imports and write it to file.writeToString(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
- 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(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.
-