Class SerdeImportVisitor

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

@Internal public final class SerdeImportVisitor extends Object implements io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
When Micronaut Serialization is on the annotation processor path, imports into it (@SerdeImport) the records LangChain4j maps to and from JSON: the structured outputs of the AI services and agents, and the parameters and results of the tools, with the records they are made of. With micronaut-langchain4j-serde, LangChain4j then maps them with their compile-time introspection, without reflection.

Only public records are imported (Micronaut Serialization cannot import other types): the properties of a record are its components, whereas a class whose fields are only reachable reflectively would be written as an empty object. Classes, and types annotated with @Serdeable or @Introspected already, are left as they are: micronaut-langchain4j-serde maps a type without a @Serdeable introspection with its @Introspected introspection, or reflectively with micronaut-reflection.

Since:
2.4.0
  • 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
     
    io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind
     
    void
    start(io.micronaut.inject.visitor.VisitorContext visitorContext)
     
    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.order.Ordered

    getOrder

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

    isEnabled

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

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

    • SerdeImportVisitor

      public SerdeImportVisitor()
  • Method Details

    • getSupportedAnnotationNames

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

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

      public void start(io.micronaut.inject.visitor.VisitorContext visitorContext)
      Specified by:
      start in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
    • 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>