ScalarMarshaller
Provides an SPI to allow different scalar datatypes to be marshalled to and from GraphQL scalar types.
The implementations are called following a chain-of-responsibility pattern, first one matching is used. Use javax.annotation.Priority (with org.apache.causeway.applib.annotation.PriorityPrecedence values) to override the framework-provided defaults, earliest wins.
API
ScalarMarshaller.java
interface ScalarMarshaller<K> {
boolean handles(Class<?> javaClass) (1)
GraphQLScalarType getGqlScalarType() (2)
K unmarshal(Object graphValue, Class<?> targetType) (3)
}
1 | handles(Class)
Whether this marshaller is able to marshall/unmarshall the provided Java class. |
2 | getGqlScalarType()
The corresponding GraphQL scalar type for the Java-class. |
3 | unmarshal(Object, Class)
Unmarshal the provided graphQL value into its Java equivalent. |