Class JsonIdentityReferenceDefinitionProvider
- java.lang.Object
-
- com.github.victools.jsonschema.module.jackson.JsonIdentityReferenceDefinitionProvider
-
- All Implemented Interfaces:
CustomDefinitionProviderV2,StatefulConfig
public class JsonIdentityReferenceDefinitionProvider extends Object implements CustomDefinitionProviderV2
Implementation of theCustomDefinitionProviderV2interface for handling types with the@JsonIdentityReference(alwaysAsid = true)identityReferenceAnnotation.
-
-
Constructor Summary
Constructors Constructor Description JsonIdentityReferenceDefinitionProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<com.fasterxml.classmate.ResolvedType>getIdentityReferenceType(com.fasterxml.classmate.ResolvedType javaType, TypeContext typeContext)If applicable, determine the type of the identity reference that should replace the given actual type, if the@JsonIdentityReference(alwaysAsId = true)annotation is present as well as a corresponding@JsonIdentityInfoannotation on the type itself.Optional<com.fasterxml.classmate.ResolvedType>getIdentityReferenceType(MemberScope<?,?> scope)If applicable, determine the type of the identity reference that should replace the given field/method's type, if the@JsonIdentityReference(alwaysAsId = true)annotation is present as well as a corresponding@JsonIdentityInfoannotation on the type itself.CustomPropertyDefinitionprovideCustomPropertySchemaDefinition(MemberScope<?,?> scope, SchemaGenerationContext context)Implementation of theCustomPropertyDefinitionProviderinterface that can be used for both fields and methods.CustomDefinitionprovideCustomSchemaDefinition(com.fasterxml.classmate.ResolvedType javaType, SchemaGenerationContext context)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.victools.jsonschema.generator.StatefulConfig
resetAfterSchemaGenerationFinished
-
-
-
-
Method Detail
-
provideCustomSchemaDefinition
public CustomDefinition provideCustomSchemaDefinition(com.fasterxml.classmate.ResolvedType javaType, SchemaGenerationContext context)
- Specified by:
provideCustomSchemaDefinitionin interfaceCustomDefinitionProviderV2
-
provideCustomPropertySchemaDefinition
public CustomPropertyDefinition provideCustomPropertySchemaDefinition(MemberScope<?,?> scope, SchemaGenerationContext context)
Implementation of theCustomPropertyDefinitionProviderinterface that can be used for both fields and methods.- Parameters:
scope- field/method on which to check for the@JsonIdentityReferenceannotationcontext- generation context enabling the standard schema generation for the identity property's value type- Returns:
- created custom definition (may be
null)
-
getIdentityReferenceType
public Optional<com.fasterxml.classmate.ResolvedType> getIdentityReferenceType(com.fasterxml.classmate.ResolvedType javaType, TypeContext typeContext)
If applicable, determine the type of the identity reference that should replace the given actual type, if the@JsonIdentityReference(alwaysAsId = true)annotation is present as well as a corresponding@JsonIdentityInfoannotation on the type itself.- Parameters:
javaType- reference type that may be replaced by a reference to its identity propertytypeContext- type context providing convenience methods, e.g., for the annotation or member look-up- Returns:
- designated type of the applicable identity reference (may be empty)
-
getIdentityReferenceType
public Optional<com.fasterxml.classmate.ResolvedType> getIdentityReferenceType(MemberScope<?,?> scope)
If applicable, determine the type of the identity reference that should replace the given field/method's type, if the@JsonIdentityReference(alwaysAsId = true)annotation is present as well as a corresponding@JsonIdentityInfoannotation on the type itself.- Parameters:
scope- field/method that may be replaced by a reference to its identity property- Returns:
- designated type of the applicable identity reference (may be empty)
-
-