Class CustomScalarRegistryImpl
java.lang.Object
com.graphql_java_generator.customscalars.CustomScalarRegistryImpl
- All Implemented Interfaces:
CustomScalarRegistry
- Author:
- etienne-sf
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCustomScalar
(String graphQLTypeName) Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.static CustomScalarRegistry
getCustomScalarRegistry
(String schema) Retrieves theCustomScalarRegistry
for the given schema.graphql.schema.GraphQLScalarType
getGraphQLCustomScalarType
(String graphQLTypeName) Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.void
registerGraphQLScalarType
(graphql.schema.GraphQLScalarType type, Class<?> valueClazz) Manually register oneGraphQLScalarType
.static void
setCustomScalarRegistry
(String schema, CustomScalarRegistry customScalarRegistry) Sets theCustomScalarRegistry
for the given schema.
-
Constructor Details
-
CustomScalarRegistryImpl
public CustomScalarRegistryImpl()
-
-
Method Details
-
registerGraphQLScalarType
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
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
-
getCustomScalarRegistry
Retrieves theCustomScalarRegistry
for the given schema. This registry is initialized in the generated classCustomScalarRegistryInitializer
.
Note: this method is an internal utility method.- Parameters:
schema
- value of the springBeanSuffix plugin parameter for the searched schema. When there is only one schema, this plugin parameter is usually not set. In this case, its default value ("") is used.- Returns:
- Throws:
IllegalArgumentException
- If noCustomScalarRegistry
has been defined for the given schema
-
setCustomScalarRegistry
public static void setCustomScalarRegistry(String schema, CustomScalarRegistry customScalarRegistry) Sets theCustomScalarRegistry
for the given schema. This method should only be called from the generated classCustomScalarRegistryInitializer
.
Note: this method is an internal utility method.- Parameters:
schema
- value of the springBeanSuffix plugin parameter for the searched schema. When there is only one schema, this plugin parameter is usually not set. In this case, its default value ("") is used.customScalarRegistry
- TheCustomScalarRegistry
associated with this schema
-