Class AbstractClassGenerator
java.lang.Object
no.sikt.graphitron.generators.abstractions.AbstractClassGenerator
- All Implemented Interfaces:
ClassGenerator
- Direct Known Subclasses:
AbstractSchemaClassGenerator,CodeInterfaceClassGenerator,TransformerClassGenerator,TypeRegistryClassGenerator,WiringClassGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerate the classes and write them to a String.voidgenerateAllToDirectory(String path, String packagePath) no.sikt.graphitron.javapoet.ClassNamegetGeneratedClassName(String name) no.sikt.graphitron.javapoet.TypeSpec.BuildergetSpec(String className, List<? extends MethodGenerator> generators) no.sikt.graphitron.javapoet.TypeSpec.BuildergetSpec(String className, MethodGenerator generator) protected voidsetDependencies(List<? extends MethodGenerator> generators, no.sikt.graphitron.javapoet.TypeSpec.Builder spec) Add all the dependency fields for this class.voidwriteToFile(no.sikt.graphitron.javapoet.TypeSpec generatedClass, String path, String packagePath) Create theJavaFilefor this class, add any common static imports and write it to file.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 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
public no.sikt.graphitron.javapoet.TypeSpec.Builder getSpec(String className, List<? extends MethodGenerator> generators) - 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
public no.sikt.graphitron.javapoet.TypeSpec.Builder getSpec(String className, MethodGenerator generator) -
setDependencies
protected void setDependencies(List<? extends MethodGenerator> generators, no.sikt.graphitron.javapoet.TypeSpec.Builder spec) 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
public void writeToFile(no.sikt.graphitron.javapoet.TypeSpec generatedClass, String path, String packagePath) 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(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- 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.
-