This implements a TransitCardRegistryCompiler annotation processor that uses Crumb to automatically track transit cards and generate them in a top level registry.
High level architecture:
Three modules
farebot-transit-registry-annotations for the @TransitCard and @TransitCardRegistry annotations
farebot-transit-registry-compiler for the actual annotation processor (for both producing and consuming annotations)
farebot-transit-registry for a simple registry instance for use upstream. Separate module for modularity
Transit cards need only be annotated with @TransitCard now to be registered
The compiler generates kotlin code via kotlinpoet, and can statically generate the full mapping of card types and list of available cards into a simple create() extension function
I didn't know if you wanted to tweak anything about the top level registry API, so left that mostly alone right now and just made it wrap the generated registry.
This implements a
TransitCardRegistryCompiler
annotation processor that uses Crumb to automatically track transit cards and generate them in a top level registry.High level architecture:
farebot-transit-registry-annotations
for the@TransitCard
and@TransitCardRegistry
annotationsfarebot-transit-registry-compiler
for the actual annotation processor (for both producing and consuming annotations)farebot-transit-registry
for a simple registry instance for use upstream. Separate module for modularity@TransitCard
now to be registeredcreate()
extension functionI didn't know if you wanted to tweak anything about the top level registry API, so left that mostly alone right now and just made it wrap the generated registry.