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 graphql.schema.GraphQLScalarType
getGraphQLScalarType(java.lang.String graphQLTypeName)
Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.void
registerAllGraphQLScalarType()
This method registers allGraphQLScalarType
that are declared as SpringComponent
.void
registerGraphQLScalarType(graphql.schema.GraphQLScalarType type)
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
-
registerAllGraphQLScalarType
public void registerAllGraphQLScalarType()This method registers allGraphQLScalarType
that are declared as SpringComponent
. Another way to registerGraphQLScalarType
is to call theCustomScalarRegistry.registerGraphQLScalarType(GraphQLScalarType)
.
This implementation works only if this class has been loaded as a Spring Component.- Specified by:
registerAllGraphQLScalarType
in interfaceCustomScalarRegistry
-
registerGraphQLScalarType
public void registerGraphQLScalarType(graphql.schema.GraphQLScalarType type)Manually register oneGraphQLScalarType
.- Specified by:
registerGraphQLScalarType
in interfaceCustomScalarRegistry
-
getGraphQLScalarType
public graphql.schema.GraphQLScalarType getGraphQLScalarType(java.lang.String graphQLTypeName)Retrieves the registeredGraphQLScalarType
for this GraphQL CustomScalar.- Specified by:
getGraphQLScalarType
in interfaceCustomScalarRegistry
- Returns:
- the
GraphQLScalarType
, or null if no converter has been registered for the given name
-