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.ReferencecreateReferenceForAdapter(org.jboss.jandex.Type fieldType, Annotations annotations, Direction direction)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(org.jboss.jandex.Type fieldType, org.jboss.jandex.Type methodType, Annotations annotations, Direction direction, 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.TypeAutoNameStrategygetTypeAutoNameStrategy()Get the Type auto name strategyQueue<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
-
getTypeAutoNameStrategy
public TypeAutoNameStrategy getTypeAutoNameStrategy()
Get the Type auto name strategy- Returns:
- the strategy as supplied
-
createReferenceForAdapter
public Reference createReferenceForAdapter(org.jboss.jandex.Type fieldType, Annotations annotations, Direction direction)
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(org.jboss.jandex.Type fieldType, org.jboss.jandex.Type methodType, Annotations annotations, Direction direction, 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
-
-