Class CustomScalarRegistryImpl
java.lang.Object
com.graphql_java_generator.customscalars.CustomScalarRegistryImpl
- All Implemented Interfaces:
CustomScalarRegistry
@Component public class CustomScalarRegistryImpl extends java.lang.Object implements CustomScalarRegistry
- Author:
- etienne-sf
-
Field Summary
Fields Modifier and Type Field Description static CustomScalarRegistry
customScalarRegistry
As we may have or not have Spring at runtime, we manually manage a singleton. -
Constructor Summary
Constructors Constructor Description CustomScalarRegistryImpl()
-
Method Summary
Modifier and Type Method Description CustomScalar
getCustomScalar(java.lang.String graphQLTypeName)
Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.graphql.schema.GraphQLScalarType
getGraphQLCustomScalarType(java.lang.String graphQLTypeName)
Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.void
registerGraphQLScalarType(graphql.schema.GraphQLScalarType type, java.lang.Class<?> valueClazz)
Manually register oneGraphQLScalarType
.
-
Field Details
-
customScalarRegistry
As we may have or not have Spring at runtime, we manually manage a singleton. This field is private, and should only be accessed through#getCustomScalarRegistry()
.
-
-
Constructor Details
-
CustomScalarRegistryImpl
public CustomScalarRegistryImpl()
-
-
Method Details
-
registerGraphQLScalarType
public void registerGraphQLScalarType(graphql.schema.GraphQLScalarType type, java.lang.Class<?> valueClazz)Description copied from interface:CustomScalarRegistry
Manually register oneGraphQLScalarType
.- Specified by:
registerGraphQLScalarType
in interfaceCustomScalarRegistry
valueClazz
- The java The java type that will contain values for this custom scalar. This is needed to properly create the data from the value read in a string, especially when reading a GraphQL request, when in client mode
-
getGraphQLCustomScalarType
public graphql.schema.GraphQLScalarType getGraphQLCustomScalarType(java.lang.String graphQLTypeName)Description copied from interface:CustomScalarRegistry
Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.- Specified by:
getGraphQLCustomScalarType
in interfaceCustomScalarRegistry
- Returns:
- the
GraphQLScalarType
, or null if no converter has been registered for the given name
-
getCustomScalar
Description copied from interface:CustomScalarRegistry
Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.- Specified by:
getCustomScalar
in interfaceCustomScalarRegistry
- Returns:
- the
GraphQLScalarType
, or null if no converter has been registered for the given name
-