Class LegacyCoercingInputInterceptor
- java.lang.Object
-
- graphql.execution.values.legacycoercing.LegacyCoercingInputInterceptor
-
- All Implemented Interfaces:
InputInterceptor
public class LegacyCoercingInputInterceptor extends java.lang.Object implements InputInterceptor
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.BiFunction<java.lang.Object,GraphQLInputType,java.lang.Object>behavior
-
Constructor Summary
Constructors Modifier Constructor Description privateLegacyCoercingInputInterceptor(java.util.function.BiFunction<java.lang.Object,GraphQLInputType,java.lang.Object> behavior)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.ObjectcoerceLegacyBooleanValue(java.lang.Object input)(package private) static java.lang.ObjectcoerceLegacyFloatValue(java.lang.Object input)(package private) static java.lang.ObjectcoerceLegacyIntValue(java.lang.Object input)(package private) static java.lang.ObjectcoerceLegacyStringValue(java.lang.Object input)java.lang.Objectintercept(@Nullable java.lang.Object input, @NotNull GraphQLInputType graphQLType, @NotNull GraphQLContext graphqlContext, @NotNull java.util.Locale locale)This is called with a value that is to be presented to theValuesResolvercode.(package private) static booleanisLegacyBooleanValue(java.lang.Object input)(package private) static booleanisLegacyFloatValue(java.lang.Object input)(package private) static booleanisLegacyIntValue(java.lang.Object input)(package private) static booleanisLegacyStringValue(java.lang.Object input)(package private) static booleanisLegacyValue(java.lang.Object input, GraphQLInputType graphQLType)static LegacyCoercingInputInterceptormigratesValues()This will change legacy values as it encounters them to something acceptable to the more strict coercion rules.static LegacyCoercingInputInterceptormigratesValues(java.util.function.BiConsumer<java.lang.Object,GraphQLInputType> observerCallback)This will change legacy values as it encounters them to something acceptable to the more strict coercion rules.static LegacyCoercingInputInterceptorobservesValues(java.util.function.BiConsumer<java.lang.Object,GraphQLInputType> observerCallback)This will ONLY observe legacy values and invoke the callback when it gets one.
-
-
-
Field Detail
-
behavior
private final java.util.function.BiFunction<java.lang.Object,GraphQLInputType,java.lang.Object> behavior
-
-
Constructor Detail
-
LegacyCoercingInputInterceptor
private LegacyCoercingInputInterceptor(java.util.function.BiFunction<java.lang.Object,GraphQLInputType,java.lang.Object> behavior)
-
-
Method Detail
-
observesValues
public static LegacyCoercingInputInterceptor observesValues(java.util.function.BiConsumer<java.lang.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
public static LegacyCoercingInputInterceptor 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(java.util.function.BiConsumer<java.lang.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 java.lang.Object intercept(@Nullable @Nullable java.lang.Object input, @NotNull @NotNull GraphQLInputType graphQLType, @NotNull @NotNull GraphQLContext graphqlContext, @NotNull @NotNull java.util.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
static boolean isLegacyValue(java.lang.Object input, GraphQLInputType graphQLType)
-
isLegacyBooleanValue
static boolean isLegacyBooleanValue(java.lang.Object input)
-
isLegacyFloatValue
static boolean isLegacyFloatValue(java.lang.Object input)
-
isLegacyIntValue
static boolean isLegacyIntValue(java.lang.Object input)
-
isLegacyStringValue
static boolean isLegacyStringValue(java.lang.Object input)
-
coerceLegacyBooleanValue
static java.lang.Object coerceLegacyBooleanValue(java.lang.Object input)
-
coerceLegacyFloatValue
static java.lang.Object coerceLegacyFloatValue(java.lang.Object input)
-
coerceLegacyIntValue
static java.lang.Object coerceLegacyIntValue(java.lang.Object input)
-
coerceLegacyStringValue
static java.lang.Object coerceLegacyStringValue(java.lang.Object input)
-
-