Class SerdeSourceGenRecursion
java.lang.Object
io.micronaut.serde.processor.sourcegen.SerdeSourceGenRecursion
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisDirectlyRecursive(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.booleanisIndirectlyRecursive(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.
-
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 forpropertyType- The property type- Returns:
trueif 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:
trueif the property serde has to be resolved lazily
-