Package io.leangen.graphql.metadata
Class Resolver
- java.lang.Object
-
- io.leangen.graphql.metadata.Resolver
-
public class Resolver extends Object
Class representing a single method used to resolve a specific query given specific arguments. A single query can have multiple resolvers, corresponding to different combinations of arguments. This is done mainly to support attaching multiple overloaded methods as resolvers for the same query. Two resolvers of the same query must not accept the same list of argument names.- Author:
- bojan.tomic (kaqqao)
-
-
Constructor Summary
Constructors Constructor Description Resolver(String operationName, String operationDescription, String operationDeprecationReason, boolean batched, Executable<?> executable, TypedElement typedElement, List<OperationArgument> arguments, String complexityExpression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object that)List<OperationArgument>getArguments()StringgetComplexityExpression()Executable<?>getExecutable()StringgetOperationDeprecationReason()StringgetOperationDescription()StringgetOperationName()Class<?>getRawReturnType()AnnotatedTypegetReturnType()Set<Type>getSourceTypes()Gets the generic Java types of the source objects (object returned by the parent query), if one is accepted by this resolver.TypedElementgetTypedElement()inthashCode()booleanisAsync()booleanisBatched()Objectresolve(Object source, Object[] args)Calls the underlying resolver method/fieldStringtoString()
-
-
-
Constructor Detail
-
Resolver
public Resolver(String operationName, String operationDescription, String operationDeprecationReason, boolean batched, Executable<?> executable, TypedElement typedElement, List<OperationArgument> arguments, String complexityExpression)
-
-
Method Detail
-
resolve
public Object resolve(Object source, Object[] args) throws InvocationTargetException, IllegalAccessException
Calls the underlying resolver method/field- Parameters:
source- The object on which the method/field is to be calledargs- Arguments to the underlying method (empty if the underlying resolver is a field)- Returns:
- The result returned by the underlying method/field
- Throws:
InvocationTargetException- If a reflective invocation of the underlying method/field failsIllegalAccessException- If a reflective invocation of the underlying method/field is not allowed
-
getSourceTypes
public Set<Type> getSourceTypes()
Gets the generic Java types of the source objects (object returned by the parent query), if one is accepted by this resolver. Used to decide if this query can be nested inside another.- Returns:
- The generic Java type of the source object, or null if this resolver does not accept one.
-
getOperationName
public String getOperationName()
-
isBatched
public boolean isBatched()
-
isAsync
public boolean isAsync()
-
getOperationDescription
public String getOperationDescription()
-
getOperationDeprecationReason
public String getOperationDeprecationReason()
-
getArguments
public List<OperationArgument> getArguments()
-
getTypedElement
public TypedElement getTypedElement()
-
getReturnType
public AnnotatedType getReturnType()
-
getRawReturnType
public Class<?> getRawReturnType()
-
getComplexityExpression
public String getComplexityExpression()
-
getExecutable
public Executable<?> getExecutable()
-
-