Skip to content

Moving expensive code from runtime to compilation using ahead-of-time compilation? #4947

Discussion options

You must be logged in to vote

So in general Micronaut's compile time facilities are for processing source code and generating files based on the definition of annotations in the source code via annotation processing.

There are two modes for this, one is an isolating generator that generates a single source file for each annotated class. Say for example you want to generate some schema JSON file for each class annotated with @Entity you could do that by defining an isolating TypeElementVisitor that visits the Entity annotation and generates a file for each class, here is some example pseudo code:

public final class SchemaGeneratingTypeElementVisitor implements TypeElementVisitor<Entity, Object> {

    private Map<Class…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tobiasschaefer
Comment options

@graemerocher
Comment options

Answer selected by tobiasschaefer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants