Class NonNullableFieldValidator


  • public class NonNullableFieldValidator
    extends java.lang.Object
    This will check that a value is non-null when the type definition says it must be and, it will throw NonNullableFieldWasNullException if this is not the case. See: https://spec.graphql.org/October2021/#sec-Errors-and-Non-Nullability
    • Method Detail

      • validate

        public <T> T validate​(ResultPath path,
                              T result)
                       throws NonNullableFieldWasNullException
        Called to check that a value is non null if the type requires it to be non null
        Type Parameters:
        T - the type of the result
        Parameters:
        path - the path to this place
        result - the result to check
        Returns:
        the result back
        Throws:
        NonNullableFieldWasNullException - if the value is null but the type requires it to be non null