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 aNAME_SERVICE_PROPERTYservice property which is the name of the scalar type.
-
-
Field Summary
Fields Modifier and Type Field Description static StringNAME_SERVICE_PROPERTY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TparseValue(X input)Parse an external value (a query argument for example) into its internal representationXserialize(T value)Serialize an internal value (provided by aSlingDataFetcherinto its external representation.
-
-
-
Field Detail
-
NAME_SERVICE_PROPERTY
static final String NAME_SERVICE_PROPERTY
- See Also:
- Constant Field Values
-
-
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 aSlingDataFetcherinto its external representation.- Parameters:
value- the internal value- Returns:
- the external representation of the internal value
- Throws:
ScalarConversionException- if the serialization operation fails
-
-