Converters can be thought of as "post-processors" for response POJOs before they get passed to the serializer.
Converters are associated with resource classes and methods via the following:
- {@link oajr.annotation.Rest}
- {@link oajr.annotation.Rest#converters() converters}
- {@link oajr.annotation.RestOp}
- {@link oajr.annotation.RestOp#converters() converters}
| // GET person request handler.
| // Traversable conversion enabled to allow nodes in returned POJO tree to be addressed.
| // Queryable conversion enabled to allow returned POJO to be searched/viewed/sorted.
| @RestGet(
| path="/people/{id}/*",
| converters={Traversable.class,Queryable.class}
| )
| public Person getPerson(@Path("id") int id) {
| return findPerson(id);
| }
Juneau defines the following converters out-of-the-box:
- {@link oajr.converter.RestConverter}
-
{@link oajr.converter.Queryable}
Provides query parameters that can be used to transform the response (i.e. search/view/sort the
POJO response before being serialized).
-
{@link oajr.converter.Traversable}
Allows nodes in the POJO response tree to be individually accessed through additional path info on
the request.
-
{@link oajr.converter.Introspectable}
Allows method calls to be made on the response POJO, and for the result of that method call to be
serialized as the response.