public interface CodegenFiler
An abstraction for writing out source files and resource files.
Always attempts to create a new file and replace its content (as it is impossible to update files in annotation processing).
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidservices(TypeName generator, TypeName providerInterface, List<TypeName> providers, Object... originatingElements) Write aMETA-INF/servicesfile for a specific provider interface and implementation(s).writeResource(byte[] resource, String location, Object... originatingElements) Write a resource file.writeSourceFile(ClassModel classModel, Object... originatingElements) Write a source file from itsClassModel.
-
Method Details
-
writeSourceFile
Write a source file from itsClassModel.- Parameters:
classModel- class model to write outoriginatingElements- elements that caused this type to be generated (you can useTypeInfoBlueprint.originatingElement()for example- Returns:
- written path, we expect to always run on local file system
-
writeResource
Write a resource file.- Parameters:
resource- bytes of the resource filelocation- location to write to in the classes output directoryoriginatingElements- elements that caused this type to be generated- Returns:
- written path, we expect to always run on local file system
-
services
default void services(TypeName generator, TypeName providerInterface, List<TypeName> providers, Object... originatingElements) Write aMETA-INF/servicesfile for a specific provider interface and implementation(s).- Parameters:
generator- type of the generator (to mention in the generated code)providerInterface- type of the provider interface (and also name of the file to be generated)providers- list of provider implementations to add to the fileoriginatingElements- elements that caused this type to be generated
-