Class DispatchWriter

java.lang.Object
io.micronaut.inject.writer.DispatchWriter
All Implemented Interfaces:
ClassOutputWriter

@Internal public final class DispatchWriter extends Object implements ClassOutputWriter
Switch based dispatch writer.
Since:
4.7
Author:
Denis Stepanov
  • Constructor Details

    • DispatchWriter

      public DispatchWriter()
  • Method Details

    • addSetField

      public int addSetField(FieldElement beanField)
      Adds new set field dispatch target.
      Parameters:
      beanField - The field
      Returns:
      the target index
    • addGetField

      public int addGetField(FieldElement beanField)
      Adds new get field dispatch target.
      Parameters:
      beanField - The field
      Returns:
      the target index
    • addMethod

      public int addMethod(TypedElement declaringType, MethodElement methodElement)
      Adds new method dispatch target.
      Parameters:
      declaringType - The declaring type
      methodElement - The method element
      Returns:
      the target index
    • addMethod

      public int addMethod(TypedElement declaringType, MethodElement methodElement, boolean useOneDispatch)
      Adds new method dispatch target.
      Parameters:
      declaringType - The declaring type
      methodElement - The method element
      useOneDispatch - If method should be dispatched using "dispatchOne"
      Returns:
      the target index
    • addInterceptedMethod

      public int addInterceptedMethod(TypedElement declaringType, MethodElement methodElement, String interceptedProxyClassName, String interceptedProxyBridgeMethodName)
      Adds new interceptable method dispatch target.
      Parameters:
      declaringType - The declaring type
      methodElement - The method element
      interceptedProxyClassName - The interceptedProxyClassName
      interceptedProxyBridgeMethodName - The interceptedProxyBridgeMethodName
      Returns:
      the target index
    • addDispatchTarget

      public int addDispatchTarget(DispatchWriter.DispatchTarget dispatchTarget)
      Adds new custom dispatch target.
      Parameters:
      dispatchTarget - The dispatch target implementation
      Returns:
      the target index
    • buildDispatchMethod

      @Nullable public @Nullable io.micronaut.sourcegen.model.MethodDef buildDispatchMethod()
    • buildDispatchOneMethod

      @Nullable public @Nullable io.micronaut.sourcegen.model.MethodDef buildDispatchOneMethod()
    • buildGetTargetMethodByIndex

      @Nullable public @Nullable io.micronaut.sourcegen.model.MethodDef buildGetTargetMethodByIndex()
    • getTypeUtilsGetRequiredMethod

      public static io.micronaut.sourcegen.model.ExpressionDef getTypeUtilsGetRequiredMethod(io.micronaut.sourcegen.model.ClassTypeDef declaringType, MethodElement methodElement)
    • accept

      public void accept(ClassWriterOutputVisitor classWriterOutputVisitor) throws IOException
      Description copied from interface: ClassOutputWriter
      Accept a ClassWriterOutputVisitor to write this writer to disk.
      Specified by:
      accept in interface ClassOutputWriter
      Parameters:
      classWriterOutputVisitor - The ClassWriterOutputVisitor
      Throws:
      IOException - if there is an error writing to disk
    • getDispatchTargets

      public List<DispatchWriter.DispatchTarget> getDispatchTargets()
      Returns:
      all added dispatch targets
    • isHasInterceptedMethod

      public boolean isHasInterceptedMethod()
      Returns:
      if intercepted method dispatch have been added