Class LegacyCoercingInputInterceptor
java.lang.Object
graphql.execution.values.legacycoercing.LegacyCoercingInputInterceptor
- All Implemented Interfaces:
InputInterceptor
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLegacyCoercingInputInterceptor(BiFunction<Object, GraphQLInputType, Object> behavior) -
Method Summary
Modifier and TypeMethodDescription(package private) static ObjectcoerceLegacyBooleanValue(Object input) (package private) static ObjectcoerceLegacyFloatValue(Object input) (package private) static ObjectcoerceLegacyIntValue(Object input) (package private) static ObjectcoerceLegacyStringValue(Object input) intercept(@Nullable Object input, @NotNull GraphQLInputType graphQLType, @NotNull GraphQLContext graphqlContext, @NotNull Locale locale) This is called with a value that is to be presented to theValuesResolvercode.(package private) static booleanisLegacyBooleanValue(Object input) (package private) static booleanisLegacyFloatValue(Object input) (package private) static booleanisLegacyIntValue(Object input) (package private) static booleanisLegacyStringValue(Object input) (package private) static booleanisLegacyValue(Object input, GraphQLInputType graphQLType) This will change legacy values as it encounters them to something acceptable to the more strict coercion rules.migratesValues(BiConsumer<Object, GraphQLInputType> observerCallback) This will change legacy values as it encounters them to something acceptable to the more strict coercion rules.observesValues(BiConsumer<Object, GraphQLInputType> observerCallback) This will ONLY observe legacy values and invoke the callback when it gets one.
-
Field Details
-
behavior
-
-
Constructor Details
-
LegacyCoercingInputInterceptor
-
-
Method Details
-
observesValues
public static LegacyCoercingInputInterceptor observesValues(BiConsumer<Object, GraphQLInputType> observerCallback) This will ONLY observe legacy values and invoke the callback when it gets one. you can use this to enumerate how many legacy values are hitting you graphql implementation- Parameters:
observerCallback- a callback allowing you to observe a legacy scalar value- Returns:
- an InputInterceptor that only observes values
-
migratesValues
This will change legacy values as it encounters them to something acceptable to the more strict coercion rules.- Returns:
- an InputInterceptor that migrates values to a more strict value
-
migratesValues
public static LegacyCoercingInputInterceptor migratesValues(BiConsumer<Object, GraphQLInputType> observerCallback) This will change legacy values as it encounters them to something acceptable to the more strict coercion rules. The observer callback will be invoked if it detects a legacy value that it will change.- Parameters:
observerCallback- a callback allowing you to observe a legacy scalar value before it is migrated- Returns:
- an InputInterceptor that both observes values and migrates them to a more strict value
-
intercept
public Object intercept(@Nullable @Nullable Object input, @NotNull @NotNull GraphQLInputType graphQLType, @NotNull @NotNull GraphQLContext graphqlContext, @NotNull @NotNull Locale locale) Description copied from interface:InputInterceptorThis is called with a value that is to be presented to theValuesResolvercode. The values may be scalars, enums and complex input types.- Specified by:
interceptin interfaceInputInterceptor- Parameters:
input- the input value that can be nullgraphQLType- the input typegraphqlContext- the graphql context in playlocale- the locale in play- Returns:
- a value that may differ from the original value
-
isLegacyValue
-
isLegacyBooleanValue
-
isLegacyFloatValue
-
isLegacyIntValue
-
isLegacyStringValue
-
coerceLegacyBooleanValue
-
coerceLegacyFloatValue
-
coerceLegacyIntValue
-
coerceLegacyStringValue
-