Class AbstractClassGenerator
java.lang.Object
no.sikt.graphitron.generators.abstractions.AbstractClassGenerator
- All Implemented Interfaces:
ClassGenerator
- Direct Known Subclasses:
AbstractSchemaClassGenerator,CodeInterfaceClassGenerator,DTOGenerator,TransformerClassGenerator,TypeRegistryClassGenerator,WiringClassGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerate the classes and write them to a String.voidgenerateAllToDirectory(String path, String packagePath) getGeneratedClassName(String name) getSpec(String className, List<? extends MethodGenerator> generators) getSpec(String className, MethodGenerator generator) protected voidsetDependencies(List<? extends MethodGenerator> generators, TypeSpec.Builder spec) Add all the dependency fields for this class.voidwriteToFile(TypeSpec generatedClass, String path, String packagePath) Create theJavaFilefor this class, add any common static imports and write it to file.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface no.sikt.graphitron.generators.abstractions.ClassGenerator
generateAll, getDefaultSaveDirectoryName, getFileNameSuffix
-
Constructor Details
-
AbstractClassGenerator
public AbstractClassGenerator()
-
-
Method Details
-
getSpec
- Specified by:
getSpecin interfaceClassGenerator- 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.
-
getSpec
-
setDependencies
Add all the dependency fields for this class.- Parameters:
generators- Generators to extract dependencies from.
-
generateAllAsMap
Description copied from interface:ClassGeneratorGenerate the classes and write them to a String.- Specified by:
generateAllAsMapin interfaceClassGenerator
-
generateAllToDirectory
- Specified by:
generateAllToDirectoryin interfaceClassGenerator- Parameters:
path- The path to the output directory.packagePath- The package path that this class should be written to.
-
writeToFile
Description copied from interface:ClassGeneratorCreate theJavaFilefor this class, add any common static imports and write it to file.- Specified by:
writeToFilein interfaceClassGenerator- Parameters:
generatedClass- A complete javapoetTypeSpec.path- The path to the output directory.packagePath- The package path that this class should be written to.
-
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- 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- Parameters:
generatedClass- A complete javapoetTypeSpec.
-
getGeneratedClassName
- Parameters:
name- Name of the class.- Returns:
- ClassName based on the default output package and save directory.
-