Interface ClassGenerator
- All Known Implementing Classes:
AbstractClassGenerator,AbstractMapperClassGenerator,AbstractSchemaClassGenerator,CodeInterfaceClassGenerator,DataFetcherClassGenerator,DBClassGenerator,DTOGenerator,EnumDTOGenerator,ExceptionStrategyConfigurationGenerator,ExceptionToErrorMappingProviderGenerator,InputDTOGenerator,InterfaceDTOGenerator,JavaRecordMapperClassGenerator,OperationClassGenerator,RecordMapperClassGenerator,SelectHelperDBClassGenerator,TransformerClassGenerator,TypeDTOGenerator,TypeRegistryClassGenerator,TypeResolverClassGenerator,UnionDTOGenerator,WiringClassGenerator
public interface ClassGenerator
A class generator generates a set of classes for any purpose.
-
Method Summary
Modifier and TypeMethodDescriptionList<no.sikt.graphitron.javapoet.TypeSpec> Generate the classes and return the list of TypeSpecs.Generate the classes and write them to a String.voidgenerateAllToDirectory(String path, String packagePath) no.sikt.graphitron.javapoet.TypeSpec.BuildergetSpec(String className, List<? extends MethodGenerator> generators) 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.
-
Method Details
-
generateAll
List<no.sikt.graphitron.javapoet.TypeSpec> generateAll()Generate the classes and return the list of TypeSpecs. -
generateAllToDirectory
- Parameters:
path- The path to the output directory.packagePath- The package path that this class should be written to.
-
writeToFile
void writeToFile(no.sikt.graphitron.javapoet.TypeSpec generatedClass, String path, String packagePath) Create theJavaFilefor this class, add any common static imports and write it to file.- Parameters:
generatedClass- A complete javapoetTypeSpec.path- The path to the output directory.packagePath- The package path that this class should be written to.
-
writeToFile
void writeToFile(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.- 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.
-
generateAllAsMap
Generate the classes and write them to a String. -
writeToString
Create theJavaFilefor this class, add any common static imports and render the file as a string.- Parameters:
generatedClass- A complete javapoetTypeSpec.
-
getDefaultSaveDirectoryName
String getDefaultSaveDirectoryName()- Returns:
- The final directory path within the package where the classes are ultimately saved.
-
getFileNameSuffix
String getFileNameSuffix()- Returns:
- The suffix that is to be added to the end of file names generated by this class.
-
getSpec
no.sikt.graphitron.javapoet.TypeSpec.Builder getSpec(String className, List<? extends MethodGenerator> generators) - 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.
-