@Override public void render(final Object object, final Context ctx) throws Exception { if (ctx.accepts(this.type)) { ctx.type(this.type) .send(gson.toJson(object)); } }
@Override public void render(final Object value, final Renderer.Context ctx) throws Exception { if (ctx.accepts(type) && mapper.canSerialize(value.getClass())) { ctx.type(type); renderValue(value, ctx); } }
@Override public void render(final Object object, final Context ctx) throws Exception { if (ctx.accepts(this.type)) { ctx.type(this.type) .send(gson.toJson(object)); } }
@Override public void render(final Object value, final Renderer.Context ctx) throws Exception { if (ctx.accepts(type) && mapper.canSerialize(value.getClass())) { ctx.type(type); renderValue(value, ctx); } }
/** * True if the given type matches the <code>Accept</code> header. * * @param type The type to check for. * @return True if the given type matches the <code>Accept</code> header. */ default boolean accepts(final String type) { return accepts(MediaType.valueOf(type)); }
/** * True if the given type matches the <code>Accept</code> header. * * @param type The type to check for. * @return True if the given type matches the <code>Accept</code> header. */ default boolean accepts(final String type) { return accepts(MediaType.valueOf(type)); }
@Override public void render(final Object object, final Context ctx) throws Exception { if (ctx.accepts(this.type)) { ctx.type(this.type) .send(jsonb.toJson(object)); } }