Basic implementation of JAX-RS abstractions ( {@link MessageBodyReader}, {@link MessageBodyWriter}) needed for binding Smile ("application/x-jackson-smile") content to and from Java Objects ("POJO"s).
Actual data binding functionality is implemented by {@link ObjectMapper}: mapper to use can be configured in multiple ways:
- By explicitly passing mapper to use in constructor
- By explictly setting mapper to use by {@link #setMapper}
- By defining JAX-RS
Provider
that returns {@link ObjectMapper}s. - By doing none of above, in which case a default mapper instance is constructed (and configured if configuration methods are called)
The last method ("do nothing specific") is often good enough; explicit passing of Mapper is simple and explicit; and Provider-based method may make sense with Depedency Injection frameworks, or if Mapper has to be configured differently for different media types.
Note that the default mapper instance will be automatically created if one of explicit configuration methods (like {@link #configure}) is called: if so, Provider-based introspection is NOT used, but the resulting Mapper is used as configured.
Note that there is also a sub-class -- ( {@link JacksonJaxbSmileProvider}) -- that is configured by default to use both Jackson and JAXB annotations for configuration (base class when used as-is defaults to using just Jackson annotations)
@author Tatu Saloranta