LensesProcessor

class LensesProcessor(codeGenerator: CodeGenerator, logger: KSPLogger) : SymbolProcessor

This Processor generates automatically functions of lenses for all public properties of a data class within the companion object of the data class.

Those functions are created during compile process within separate source files as extension functions of the companion object. That's why the user must provide a companion object within the @Lenses annotated data class of his own. The processor will detect a missing definition and throw an error. The naming schema of the generated file is based upon the name of the data class with the appended suffix Lenses.

We decided to model those generated lenses as functions, as the call to lensOf has only a small impact to the overall rendering performance compared to other aspects but enables the support for generic data classes. So if a client suffers from a bad performance because of this approach, feel free to manually implement a lens with better performance.

Constructors

Link copied to clipboard
constructor(codeGenerator: CodeGenerator, logger: KSPLogger)

Functions

Link copied to clipboard
open fun finish()
Link copied to clipboard
open fun onError()
Link copied to clipboard
open override fun process(resolver: Resolver): List<KSAnnotated>