@Override public Object swap(BeanSession session, SometimesSwappedBean1 o) throws Exception { MediaType mt = session.getMediaType(); if (mt.hasSubType("json") || mt.hasSubType("xml")) return new StringReader(o.f + "-" + mt); return o; } }
@Override public Object swap(BeanSession session, SometimesSwappedBean2 o) throws Exception { MediaType mt = session.getMediaType(); if (mt.hasSubType("json") || mt.hasSubType("xml")) return o; return new StringReader(o.f + "-" + mt); } }