Class ValueTraverser

java.lang.Object
graphql.analysis.values.ValueTraverser

@PublicApi public class ValueTraverser extends Object
This class allows you to traverse a set of input values according to the type system and optional change the values present.

If you just want to traverse without changing anything, just return the value presented to you and nothing will change.

If you want to change a value, perhaps in the presence of a directive say on the containing element, then return a new value back in your visitor.

This class is intended to be used say inside a DataFetcher, allowing you to change the DataFetchingEnvironment.getArguments() say before further processing.

The values passed in are assumed to be valid and coerced. This classes does not check for non nullness say or the right coerced objects given the type system. This is assumed to have occurred earlier in the graphql validation phase. This also means if you are not careful you can undo the validation that has gone before you. For example, it would be possible to change values that are illegal according to the type system, such as null values for non-nullable types say, so you need to be careful.

  • Constructor Details

    • ValueTraverser

      public ValueTraverser()
  • Method Details