ScalarMarshaller

Provides an SPI to allow different scalar data types 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 jakarta.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)
  boolean supportsInput()     (3)
  K unmarshal(Object graphValue, Class<?> targetType)     (4)
}
1 handles(Class)

Whether this marshaller is able to marshall/un-marshall the provided Java class.

2 getGqlScalarType()

The corresponding GraphQL scalar type for the Java-class.

3 supportsInput()

Whether this marshaller provides reversible GraphQL input coercion.

4 unmarshal(Object, Class)

Unmarshal the provided graphQL value into its Java equivalent.

Members

handles(Class)

Whether this marshaller is able to marshall/un-marshall the provided Java class.

getGqlScalarType()

The corresponding GraphQL scalar type for the Java-class.

supportsInput()

Whether this marshaller provides reversible GraphQL input coercion.

The default is false : registering output coercion never implicitly grants input capability. Reversible marshallers must opt in explicitly so unsupported inputs are rejected before domain invocation.

unmarshal(Object, Class)

Unmarshal the provided graphQL value into its Java equivalent.