Interface ClassGenerator
- All Known Implementing Classes:
AbstractClassGenerator,AbstractMapperClassGenerator,AbstractSchemaClassGenerator,CodeInterfaceClassGenerator,DataFetcherClassGenerator,DBClassGenerator,DTOGenerator,EntityFetcherClassGenerator,EnumDTOGenerator,ExceptionToErrorMappingProviderGenerator,FetchResolverClassGenerator,InputDTOGenerator,InterfaceDTOGenerator,JavaRecordMapperClassGenerator,KickstartResolverClassGenerator,MutationExceptionStrategyConfigurationGenerator,OperationClassGenerator,RecordMapperClassGenerator,ResolverClassGenerator,TransformerClassGenerator,TypeDTOGenerator,TypeRegistryClassGenerator,TypeResolverClassGenerator,UnionDTOGenerator,UpdateResolverClassGenerator,WiringClassGenerator
public interface ClassGenerator
A class generator generates a set of classes for any purpose.
-
Method Summary
Modifier and TypeMethodDescriptionGenerate the classes and return the list of TypeSpecs.Generate the classes and write them to a String.voidgenerateAllToDirectory(String path, String packagePath) getSpec(String className, List<? extends MethodGenerator> generators) 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.
-
Method Details
-
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
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(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
- 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.
-