Interface SlingScalarConverter<T,​X>


  • @ConsumerType
    public interface SlingScalarConverter<T,​X>
    A service that parses and serializes a custom GraphQL Scalar by converting between an eXternal type X an an inTernal one T. Instances of this service must have a NAME_SERVICE_PROPERTY service property which is the name of the scalar type.
    • Method Detail

      • parseValue

        @Nullable
        T parseValue​(@Nullable
                     X input)
              throws ScalarConversionException
        Parse an external value (a query argument for example) into its internal representation
        Parameters:
        input - the external value to parse
        Returns:
        the internal representation of the passed input
        Throws:
        ScalarConversionException - if the parsing operation fails
      • serialize

        @Nullable
        X serialize​(@Nullable
                    T value)
             throws ScalarConversionException
        Serialize an internal value (provided by a SlingDataFetcher into its external representation.
        Parameters:
        value - the internal value
        Returns:
        the external representation of the internal value
        Throws:
        ScalarConversionException - if the serialization operation fails