{8.1.0-updated} Transforms

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

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

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

The programmatic equivalent to this is:

// Servlet with properties applied @Rest(...) public MyRestServlet extends BasicRestServlet { public MyRestServlet(RestContextBuilder builder) { builder .swaps( TemporalCalendarSwap.IsoInstant.class, ByteArraySwap.Base64.class ) .beanFilters(MyInterface.class); } }