Class SerdeSourceGenRecursion

java.lang.Object
io.micronaut.serde.processor.sourcegen.SerdeSourceGenRecursion

@Internal public final class SerdeSourceGenRecursion extends Object
Detects property types that can refer back to the type a serde is generated for.

Generated serdes resolve their property serdes on construction, and the registry creates a new generated serde for every specific lookup. A property whose type reaches the owning type again, such as List<Self> or a property of another type that refers back to the owner, would construct the owning serde again without end, so such properties resolve their serde lazily.

  • Constructor Summary

    Constructors
    Constructor
    Description
    SerdeSourceGenRecursion(io.micronaut.inject.ast.ClassElement owner)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isDirectlyRecursive(io.micronaut.inject.ast.ClassElement owner, io.micronaut.inject.ast.ClassElement propertyType)
    Whether the property type is the owning type itself, so the generated serde can reuse itself.
    boolean
    isIndirectlyRecursive(io.micronaut.inject.ast.ClassElement propertyType)
    Whether the property type can refer back to the owning type, other than being the owning type itself, which the generated serdes handle by reusing themselves.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SerdeSourceGenRecursion

      public SerdeSourceGenRecursion(io.micronaut.inject.ast.ClassElement owner)
      Parameters:
      owner - The type the serde is generated for
  • Method Details

    • isDirectlyRecursive

      public static boolean isDirectlyRecursive(io.micronaut.inject.ast.ClassElement owner, io.micronaut.inject.ast.ClassElement propertyType)
      Whether the property type is the owning type itself, so the generated serde can reuse itself.
      Parameters:
      owner - The type the serde is generated for
      propertyType - The property type
      Returns:
      true if the property type is the owning type
    • isIndirectlyRecursive

      public boolean isIndirectlyRecursive(io.micronaut.inject.ast.ClassElement propertyType)
      Whether the property type can refer back to the owning type, other than being the owning type itself, which the generated serdes handle by reusing themselves.
      Parameters:
      propertyType - The property type
      Returns:
      true if the property serde has to be resolved lazily