Class MyBatisMapperScanReflectionVisitor

java.lang.Object
io.micronaut.configuration.mybatis.processor.MyBatisMapperScanReflectionVisitor
All Implemented Interfaces:
io.micronaut.core.order.Ordered, io.micronaut.core.util.Toggleable, io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>

@Internal public final class MyBatisMapperScanReflectionVisitor extends Object implements io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
Adds the GraalVM native image metadata of the mappers registered by MyBatisMapperScan as ReflectionConfig values to the annotated type: MyBatis implements mapper interfaces with Proxy, and instantiates and populates their result and parameter types reflectively.

The metadata itself is generated by the Micronaut GraalTypeElementVisitor from those values, exactly like for @ReflectiveAccess. That visitor is TypeElementVisitor.VisitorKind.ISOLATING and runs at order -200, so this visitor must be isolating as well (isolating and aggregating visitors run in different annotation processors on javac) and ordered before it, see getOrder().

Like MyBatisMapperScanVisitor, the visitor visits every class because it has to see the unannotated mapper interfaces. Visitors process all classes before the next visitor runs, so the values added here are complete by the time the Graal visitor reaches the annotated type.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.micronaut.inject.visitor.TypeElementVisitor

    io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    finish(io.micronaut.inject.visitor.VisitorContext visitorContext)
     
    int
     
    io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind
     
    void
    visitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.util.Toggleable

    isEnabled

    Methods inherited from interface io.micronaut.inject.visitor.TypeElementVisitor

    getClassType, getElementType, getSupportedAnnotationNames, getSupportedOptions, query, start, visitConstructor, visitEnumConstant, visitField, visitMethod
  • Constructor Details

    • MyBatisMapperScanReflectionVisitor

      public MyBatisMapperScanReflectionVisitor()
  • Method Details

    • getVisitorKind

      public io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind getVisitorKind()
      Specified by:
      getVisitorKind in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface io.micronaut.core.order.Ordered
    • visitClass

      public void visitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context)
      Specified by:
      visitClass in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
    • finish

      public void finish(io.micronaut.inject.visitor.VisitorContext visitorContext)
      Specified by:
      finish in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>