@PublicApi public class GraphQLTypeUtil extends java.lang.Object
GraphQLType
sConstructor and Description |
---|
GraphQLTypeUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isEnum(GraphQLType type)
Returns true if the given type is an enum type
|
static boolean |
isInput(GraphQLType type)
Returns true if the given type is an input type
|
static boolean |
isInterfaceOrUnion(GraphQLType type) |
static boolean |
isLeaf(GraphQLType type)
Returns true if the given type is a leaf type, that it cant contain any more fields
|
static boolean |
isList(GraphQLType type)
Returns true if the given type is a list type
|
static boolean |
isNonNull(GraphQLType type)
Returns true if the given type is a non null type
|
static boolean |
isNotWrapped(GraphQLType type)
Returns true if the given type is NOT a non null or list type
|
static boolean |
isNullable(GraphQLType type)
Returns true if the given type is a nullable type
|
static boolean |
isObjectType(GraphQLType type) |
static boolean |
isScalar(GraphQLType type)
Returns true if the given type is a scalar type
|
static java.util.function.Predicate<GraphQLNamedSchemaElement> |
isSystemElement()
This predicate returns true if the schema element is an inbuilt schema element
such as the system scalars and directives or introspection types
|
static boolean |
isWrapped(GraphQLType type)
Returns true if the given type is a non null or list type, that is a wrapped type
|
static java.lang.String |
simplePrint(GraphQLSchemaElement schemaElement) |
static java.lang.String |
simplePrint(GraphQLType type)
This will return the type in graphql SDL format, eg [typeName!]!
|
static GraphQLUnmodifiedType |
unwrapAll(GraphQLType type)
Unwraps all layers of the type or just returns the type again if it's not a wrapped type
|
static <T extends GraphQLType> |
unwrapAllAs(GraphQLType type)
Unwraps all layers of the type or just returns the type again if it's not a wrapped type
and then cast to the target type.
|
static GraphQLType |
unwrapNonNull(GraphQLType type)
Unwraps all non nullable layers of the type until it reaches a type that is not
GraphQLNonNull |
static <T extends GraphQLType> |
unwrapNonNullAs(GraphQLType type)
Unwraps all non nullable layers of the type until it reaches a type that is not
GraphQLNonNull
and then cast to the target type. |
static GraphQLType |
unwrapOne(GraphQLType type)
Unwraps one layer of the type or just returns the type again if it's not a wrapped type
|
static <T extends GraphQLType> |
unwrapOneAs(GraphQLType type)
Unwraps one layer of the type or just returns the type again if it's not a wrapped type
and then cast to the target type.
|
static java.util.Stack<GraphQLType> |
unwrapType(GraphQLType type)
graphql types can be wrapped in
GraphQLNonNull and GraphQLList type wrappers
so this method will unwrap the type down to the raw unwrapped type and return that wrapping
as a stack, with the top of the stack being the raw underling type. |
public static java.lang.String simplePrint(GraphQLType type)
type
- the type in playpublic static java.lang.String simplePrint(GraphQLSchemaElement schemaElement)
public static boolean isNonNull(GraphQLType type)
type
- the type to checkpublic static boolean isNullable(GraphQLType type)
type
- the type to checkpublic static boolean isList(GraphQLType type)
type
- the type to checkpublic static boolean isWrapped(GraphQLType type)
type
- the type to checkpublic static boolean isNotWrapped(GraphQLType type)
type
- the type to checkpublic static boolean isScalar(GraphQLType type)
type
- the type to checkpublic static boolean isEnum(GraphQLType type)
type
- the type to checkpublic static boolean isLeaf(GraphQLType type)
type
- the type to checkpublic static boolean isInput(GraphQLType type)
type
- the type to checkpublic static GraphQLType unwrapOne(GraphQLType type)
type
- the type to unwrapOnepublic static <T extends GraphQLType> T unwrapOneAs(GraphQLType type)
T
- for twotype
- the type to unwrapOnepublic static GraphQLUnmodifiedType unwrapAll(GraphQLType type)
type
- the type to unwrapOnepublic static <T extends GraphQLType> T unwrapAllAs(GraphQLType type)
T
- for twotype
- the type to unwrapOnepublic static GraphQLType unwrapNonNull(GraphQLType type)
GraphQLNonNull
type
- the type to unwrapGraphQLNonNull
public static <T extends GraphQLType> T unwrapNonNullAs(GraphQLType type)
GraphQLNonNull
and then cast to the target type.T
- for twotype
- the type to unwrapGraphQLNonNull
public static java.util.Stack<GraphQLType> unwrapType(GraphQLType type)
GraphQLNonNull
and GraphQLList
type wrappers
so this method will unwrap the type down to the raw unwrapped type and return that wrapping
as a stack, with the top of the stack being the raw underling type.type
- the type to unwrappublic static boolean isInterfaceOrUnion(GraphQLType type)
public static boolean isObjectType(GraphQLType type)
public static java.util.function.Predicate<GraphQLNamedSchemaElement> isSystemElement()