Class ReferenceCreator
- java.lang.Object
-
- io.smallrye.graphql.schema.creator.ReferenceCreator
-
public class ReferenceCreator extends Object
Here we create references to things that might not yet exist. We store all references to be created later.- Author:
- Phillip Kruger (phillip.kruger@redhat.com)
-
-
Constructor Summary
Constructors Constructor Description ReferenceCreator(TypeAutoNameStrategy autoNameStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the scanned references.Map<String,Reference>collectParametrizedTypes(org.jboss.jandex.ClassInfo classInfo, List<? extends org.jboss.jandex.Type> parametrizedTypeArguments, Direction direction, Reference parentObjectReference)ReferencecreateReference(Direction direction, org.jboss.jandex.ClassInfo classInfo)This method create a reference to type that might not yet exist.ReferencecreateReference(Direction direction, org.jboss.jandex.ClassInfo classInfo, boolean createAdapedToType, boolean createAdapedWithType, Reference parentObjectReference, Map<String,Reference> parametrizedTypeArgumentsReferences, boolean addParametrizedTypeNameExtension)This method create a reference to type that might not yet exist.ReferencecreateReferenceForAdapter(Direction direction, org.jboss.jandex.Type fieldType, Annotations annotations)Get a reference to a field type for an adapter on a fieldReferencecreateReferenceForInterfaceField(org.jboss.jandex.Type methodType, Annotations annotationsForThisMethod, Reference parentObjectReference)Get a reference to a field (method response) on an interface Interfaces is only usable on Type, so the direction in OUT.ReferencecreateReferenceForOperationArgument(org.jboss.jandex.Type argumentType, Annotations annotationsForThisArgument)Get a reference to a argument type for an operation Direction is IN on an argument (and OUT on a field) In the case of operation, there is no field (only methods)ReferencecreateReferenceForOperationField(org.jboss.jandex.Type fieldType, Annotations annotationsForMethod)Get a reference to a field type for an operation Direction is OUT on a field (and IN on an argument) In the case of operations, there is no fields (only methods)ReferencecreateReferenceForPojoField(Direction direction, org.jboss.jandex.Type fieldType, org.jboss.jandex.Type methodType, Annotations annotations, Reference parentObjectReference)Get a reference to a Field Type for a InputType or Type.ReferencecreateReferenceForSourceArgument(org.jboss.jandex.Type argumentType, Annotations annotationsForThisArgument)Get a reference to a source argument type for an operation Direction is OUT on an argument.org.jboss.jandex.ParameterizedTypefindParametrizedParentType(org.jboss.jandex.ClassInfo classInfo)TypeAutoNameStrategygetTypeAutoNameStrategy()Queue<Reference>values(ReferenceType referenceType)Get the values for a certain type
-
-
-
Constructor Detail
-
ReferenceCreator
public ReferenceCreator(TypeAutoNameStrategy autoNameStrategy)
-
-
Method Detail
-
clear
public void clear()
Clear the scanned references. This is done when we created all references and do not need to remember what to scan.
-
values
public Queue<Reference> values(ReferenceType referenceType)
Get the values for a certain type- Parameters:
referenceType- the type- Returns:
- the references
-
createReferenceForAdapter
public Reference createReferenceForAdapter(Direction direction, org.jboss.jandex.Type fieldType, Annotations annotations)
Get a reference to a field type for an adapter on a field- Parameters:
direction- the directionfieldType- the java typeannotations- annotation on this operations method- Returns:
- a reference to the type
-
createReferenceForOperationField
public Reference createReferenceForOperationField(org.jboss.jandex.Type fieldType, Annotations annotationsForMethod)
Get a reference to a field type for an operation Direction is OUT on a field (and IN on an argument) In the case of operations, there is no fields (only methods)- Parameters:
fieldType- the java typeannotationsForMethod- annotation on this operations method- Returns:
- a reference to the type
-
createReferenceForOperationArgument
public Reference createReferenceForOperationArgument(org.jboss.jandex.Type argumentType, Annotations annotationsForThisArgument)
Get a reference to a argument type for an operation Direction is IN on an argument (and OUT on a field) In the case of operation, there is no field (only methods)- Parameters:
argumentType- the java typeannotationsForThisArgument- annotations on this argument- Returns:
- a reference to the argument
-
createReferenceForSourceArgument
public Reference createReferenceForSourceArgument(org.jboss.jandex.Type argumentType, Annotations annotationsForThisArgument)
Get a reference to a source argument type for an operation Direction is OUT on an argument.- Parameters:
argumentType- the java typeannotationsForThisArgument- annotations on this argument- Returns:
- a reference to the argument
-
createReferenceForInterfaceField
public Reference createReferenceForInterfaceField(org.jboss.jandex.Type methodType, Annotations annotationsForThisMethod, Reference parentObjectReference)
Get a reference to a field (method response) on an interface Interfaces is only usable on Type, so the direction in OUT.- Parameters:
methodType- the method response typeannotationsForThisMethod- annotations on this method- Returns:
- a reference to the type
-
createReferenceForPojoField
public Reference createReferenceForPojoField(Direction direction, org.jboss.jandex.Type fieldType, org.jboss.jandex.Type methodType, Annotations annotations, Reference parentObjectReference)
Get a reference to a Field Type for a InputType or Type. We need both the type and the getter/setter method as both is applicable.- Parameters:
direction- in or outfieldType- the field typemethodType- the method typeannotations- the annotations on the field and methodparentObjectReference- Reference of the parent PoJo use so we can evaluate generics types- Returns:
- a reference to the type
-
createReference
public Reference createReference(Direction direction, org.jboss.jandex.ClassInfo classInfo)
This method create a reference to type that might not yet exist. It also store to be created later, if we do not already know about it.- Parameters:
direction- the direction (in or out)classInfo- the Java class- Returns:
- a reference
-
createReference
public Reference createReference(Direction direction, org.jboss.jandex.ClassInfo classInfo, boolean createAdapedToType, boolean createAdapedWithType, Reference parentObjectReference, Map<String,Reference> parametrizedTypeArgumentsReferences, boolean addParametrizedTypeNameExtension)
This method create a reference to type that might not yet exist. It also store to be created later, if we do not already know about it.- Parameters:
direction- the direction (in or out)classInfo- the Java classcreateAdapedToType- create the type in the schema- Returns:
- a reference
-
getTypeAutoNameStrategy
public TypeAutoNameStrategy getTypeAutoNameStrategy()
-
collectParametrizedTypes
public Map<String,Reference> collectParametrizedTypes(org.jboss.jandex.ClassInfo classInfo, List<? extends org.jboss.jandex.Type> parametrizedTypeArguments, Direction direction, Reference parentObjectReference)
-
findParametrizedParentType
public org.jboss.jandex.ParameterizedType findParametrizedParentType(org.jboss.jandex.ClassInfo classInfo)
-
-