Package org.apache.sling.graphql.api
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.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionparseValue(X input) Parse an external value (a query argument for example) into its internal representationSerialize an internal value (provided by aSlingDataFetcherinto its external representation.
-
Field Details
-
NAME_SERVICE_PROPERTY
- See Also:
-
-
Method Details
-
parseValue
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
Serialize an internal value (provided by aSlingDataFetcherinto its external representation.- Parameters:
value- the internal value- Returns:
- the external representation of the internal value
- Throws:
ScalarConversionException- if the serialization operation fails
-