Transforms

The Juneau serializers and parsers can be configured on how to handle POJOs through the use of Transforms. (See {@doc juneau-marshall.Transforms Transforms})

Transforms are associated serializers and parsers registered on a REST resource via the following:

- {@link oajr.annotation.RestResource#beanFilters()}
- {@link oajr.annotation.RestResource#pojoSwaps()}
- {@link oajr.annotation.RestMethod#beanFilters()}
- {@link oajr.annotation.RestMethod#pojoSwaps()}
- {@link oajr.RestContextBuilder#beanFilters(Object...)}
- {@link oajr.RestContextBuilder#pojoSwaps(Object...)}

// Servlet with transforms applied @RestResource( pojoSwaps={ // Calendars should be serialized/parsed as ISO8601 date-time strings CalendarSwap. DEFAULT_ISO8601DT. class, // Byte arrays should be serialized/parsed as BASE64-encoded strings ByteArrayBase64Swap. class }, beanFilters={ // Subclasses of MyInterface will be treated as MyInterface objects. // Bean properties not defined on that interface will be ignored. } ) public MyRestServlet extends BasicRestServlet {...}

The programmatic equivalent to this is:

// Servlet with properties applied @RestResource(...) public MyRestServlet extends BasicRestServlet { public MyRestServlet(RestContextBuilder builder) { builder .pojoSwaps( CalendarSwap. DEFAULT_ISO8601DT. class, ByteArrayBase64Swap. class ) .beanFilters(MyInterface. class); } }