{8.1.0-updated,8.2.0-updated} Per-media-type Swaps
Swaps can also be defined per-media-type.
The {@link oaj.transform.PojoSwap#forMediaTypes()} method can be overridden to provide a set of media types that the swap is invoked on. It's also possible to define multiple swaps against the same POJO as long as they're differentiated by media type. When multiple swaps are defined, the best-match media type is used.
In the following example, we define 3 swaps against the same POJO. One for JSON, one for XML, and one for all other types.
When multiple swaps match the same media type, a best-match algorithm is applied to find the correct swap to use.
In later sections we describe how annotations can be used to shorten this syntax: