public class GraphQLAnnotations extends java.lang.Object implements GraphQLAnnotationsProcessor
Modifier and Type | Class and Description |
---|---|
static class |
GraphQLAnnotations.GraphQLFieldDefinitionWrapper |
Modifier and Type | Field and Description |
---|---|
protected TypeFunction |
defaultTypeFunction |
static GraphQLAnnotations |
instance |
Constructor and Description |
---|
GraphQLAnnotations() |
GraphQLAnnotations(TypeFunction defaultTypeFunction) |
Modifier and Type | Method and Description |
---|---|
protected graphql.schema.GraphQLFieldDefinition |
field(java.lang.reflect.Field field) |
protected static graphql.schema.GraphQLFieldDefinition |
field(java.lang.reflect.Method method) |
protected java.util.Map<java.lang.String,java.lang.reflect.Field> |
getAllFields(java.lang.Class c) |
protected graphql.schema.GraphQLArgument |
getArgument(java.lang.reflect.Parameter parameter,
graphql.schema.GraphQLType t) |
protected graphql.schema.GraphQLFieldDefinition |
getField(java.lang.reflect.Field field) |
protected graphql.schema.GraphQLFieldDefinition |
getField(java.lang.reflect.Method method) |
graphql.schema.GraphQLInterfaceType.Builder |
getIfaceBuilder(java.lang.Class<?> iface)
This will examine the class and return a
GraphQLInterfaceType.Builder ready for further definition |
graphql.schema.GraphQLInputObjectType |
getInputObject(graphql.schema.GraphQLObjectType graphQLType,
java.lang.String newNamePrefix)
This will turn a
GraphQLObjectType into a corresponding GraphQLInputObjectType |
static GraphQLAnnotations |
getInstance() |
graphql.schema.GraphQLType |
getInterface(java.lang.Class<?> iface)
This will examine the class and if its annotated with
GraphQLUnion it will return
a GraphQLUnionType.Builder , if its annotated with GraphQLTypeResolver it will return
a GraphQLObjectType otherwise it will return a GraphQLInterfaceType.Builder . |
graphql.schema.GraphQLObjectType |
getObject(java.lang.Class<?> object)
This will examine the object class and return a
GraphQLObjectType representation |
graphql.schema.GraphQLObjectType.Builder |
getObjectBuilder(java.lang.Class<?> object)
This will examine the object class and return a
GraphQLObjectType.Builder ready for further definition |
graphql.schema.GraphQLOutputType |
getObjectOrRef(java.lang.Class<?> object)
This will examine the object class and return a
GraphQLOutputType representation
which may be a GraphQLObjectType or a GraphQLTypeReference |
protected java.util.List<java.lang.reflect.Method> |
getOrderedMethods(java.lang.Class c) |
java.lang.String |
getTypeName(java.lang.Class<?> objectClass) |
java.util.Map<java.lang.String,graphql.schema.GraphQLType> |
getTypeRegistry() |
graphql.schema.GraphQLUnionType.Builder |
getUnionBuilder(java.lang.Class<?> iface)
This will examine the class and return a
GraphQLUnionType.Builder ready for further definition |
static graphql.schema.GraphQLType |
iface(java.lang.Class<?> iface) |
static graphql.schema.GraphQLInterfaceType.Builder |
ifaceBuilder(java.lang.Class<?> iface) |
static graphql.schema.GraphQLInputObjectType |
inputObject(graphql.schema.GraphQLObjectType graphQLType,
java.lang.String newNamePrefix) |
static graphql.schema.GraphQLObjectType |
object(java.lang.Class<?> object) |
static graphql.schema.GraphQLObjectType.Builder |
objectBuilder(java.lang.Class<?> object) |
static void |
register(TypeFunction typeFunction) |
void |
registerType(TypeFunction typeFunction) |
void |
setDefaultTypeFunction(TypeFunction function) |
static graphql.schema.GraphQLUnionType.Builder |
unionBuilder(java.lang.Class<?> iface) |
public static GraphQLAnnotations instance
protected TypeFunction defaultTypeFunction
public GraphQLAnnotations()
public GraphQLAnnotations(TypeFunction defaultTypeFunction)
public static GraphQLAnnotations getInstance()
public graphql.schema.GraphQLType getInterface(java.lang.Class<?> iface) throws GraphQLAnnotationsException
GraphQLAnnotationsProcessor
GraphQLUnion
it will return
a GraphQLUnionType.Builder
, if its annotated with GraphQLTypeResolver
it will return
a GraphQLObjectType
otherwise it will return a GraphQLInterfaceType.Builder
.getInterface
in interface GraphQLAnnotationsProcessor
iface
- interface to examineGraphQLAnnotationsException
- if the interface cannot be examinedpublic static graphql.schema.GraphQLType iface(java.lang.Class<?> iface) throws GraphQLAnnotationsException
GraphQLAnnotationsException
public graphql.schema.GraphQLUnionType.Builder getUnionBuilder(java.lang.Class<?> iface) throws GraphQLAnnotationsException, java.lang.IllegalArgumentException
GraphQLAnnotationsProcessor
GraphQLUnionType.Builder
ready for further definitiongetUnionBuilder
in interface GraphQLAnnotationsProcessor
iface
- interface to examineGraphQLUnionType.Builder
GraphQLAnnotationsException
- if the class cannot be examinedjava.lang.IllegalArgumentException
- if iface
is not an interfacepublic static graphql.schema.GraphQLUnionType.Builder unionBuilder(java.lang.Class<?> iface) throws GraphQLAnnotationsException
GraphQLAnnotationsException
public java.lang.String getTypeName(java.lang.Class<?> objectClass)
public graphql.schema.GraphQLInterfaceType.Builder getIfaceBuilder(java.lang.Class<?> iface) throws GraphQLAnnotationsException, java.lang.IllegalArgumentException
GraphQLAnnotationsProcessor
GraphQLInterfaceType.Builder
ready for further definitiongetIfaceBuilder
in interface GraphQLAnnotationsProcessor
iface
- interface to examineGraphQLInterfaceType.Builder
GraphQLAnnotationsException
- if the class cannot be examinedjava.lang.IllegalArgumentException
- if iface
is not an interfacepublic static graphql.schema.GraphQLInterfaceType.Builder ifaceBuilder(java.lang.Class<?> iface) throws GraphQLAnnotationsException, java.lang.IllegalAccessException
GraphQLAnnotationsException
java.lang.IllegalAccessException
public graphql.schema.GraphQLObjectType getObject(java.lang.Class<?> object) throws GraphQLAnnotationsException
GraphQLAnnotationsProcessor
GraphQLObjectType
representationgetObject
in interface GraphQLAnnotationsProcessor
object
- the object class to examineGraphQLObjectType
that represents that object classGraphQLAnnotationsException
- if the object class cannot be examinedpublic graphql.schema.GraphQLOutputType getObjectOrRef(java.lang.Class<?> object) throws GraphQLAnnotationsException
GraphQLAnnotationsProcessor
GraphQLOutputType
representation
which may be a GraphQLObjectType
or a GraphQLTypeReference
getObjectOrRef
in interface GraphQLAnnotationsProcessor
object
- the object class to examineGraphQLOutputType
that represents that object classGraphQLAnnotationsException
- if the object class cannot be examinedpublic static graphql.schema.GraphQLObjectType object(java.lang.Class<?> object) throws GraphQLAnnotationsException
GraphQLAnnotationsException
public graphql.schema.GraphQLObjectType.Builder getObjectBuilder(java.lang.Class<?> object) throws GraphQLAnnotationsException
GraphQLAnnotationsProcessor
GraphQLObjectType.Builder
ready for further definitiongetObjectBuilder
in interface GraphQLAnnotationsProcessor
object
- the object class to examineGraphQLObjectType.Builder
that represents that object classGraphQLAnnotationsException
- if the object class cannot be examinedpublic static graphql.schema.GraphQLObjectType.Builder objectBuilder(java.lang.Class<?> object) throws GraphQLAnnotationsException
GraphQLAnnotationsException
protected java.util.List<java.lang.reflect.Method> getOrderedMethods(java.lang.Class c)
protected java.util.Map<java.lang.String,java.lang.reflect.Field> getAllFields(java.lang.Class c)
protected graphql.schema.GraphQLFieldDefinition getField(java.lang.reflect.Field field) throws GraphQLAnnotationsException
GraphQLAnnotationsException
protected graphql.schema.GraphQLFieldDefinition field(java.lang.reflect.Field field) throws java.lang.IllegalAccessException, java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.InstantiationException
protected graphql.schema.GraphQLFieldDefinition getField(java.lang.reflect.Method method) throws GraphQLAnnotationsException
GraphQLAnnotationsException
protected static graphql.schema.GraphQLFieldDefinition field(java.lang.reflect.Method method) throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public graphql.schema.GraphQLInputObjectType getInputObject(graphql.schema.GraphQLObjectType graphQLType, java.lang.String newNamePrefix)
GraphQLAnnotationsProcessor
GraphQLObjectType
into a corresponding GraphQLInputObjectType
getInputObject
in interface GraphQLAnnotationsProcessor
graphQLType
- the graphql object typenewNamePrefix
- since graphql types MUST be unique, this prefix will be applied to the new input typesGraphQLInputObjectType
public static graphql.schema.GraphQLInputObjectType inputObject(graphql.schema.GraphQLObjectType graphQLType, java.lang.String newNamePrefix)
protected graphql.schema.GraphQLArgument getArgument(java.lang.reflect.Parameter parameter, graphql.schema.GraphQLType t) throws GraphQLAnnotationsException
GraphQLAnnotationsException
public void setDefaultTypeFunction(TypeFunction function)
public void registerType(TypeFunction typeFunction)
public static void register(TypeFunction typeFunction)
public java.util.Map<java.lang.String,graphql.schema.GraphQLType> getTypeRegistry()