Source:
public LookupListeningResource( final @Json ObjectMapper jsonMapper, final @Smile ObjectMapper smileMapper, final LookupReferencesManager manager ) { super( jsonMapper, smileMapper, new AbstractListenerHandler<LookupExtractorFactory>(new TypeReference<LookupExtractorFactory>() { }) { @Override public Response handleUpdates( InputStream inputStream, ObjectMapper mapper ) { final LookupsState state; try { state = mapper.readValue(inputStream, LookupsState.class); } catch (final IOException ex) { LOG.debug(ex, "Bad request"); return Response.status(Response.Status.BAD_REQUEST).entity(ServletResourceUtils.sanitizeException(ex)).build(); } try { for (Map.Entry<String, LookupExtractorFactoryContainer> e : state.getToLoad().entrySet()) { manager.add(e.getKey(), e.getValue()); } for (String lookupToDrop : state.getToDrop()) { manager.remove(lookupToDrop); } return Response.status(Response.Status.ACCEPTED).entity(manager.getAllLookupsState()).build(); } catch (Exception e) { LOG.error(e, "Error handling request"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } } @Override public Object post(final Map<String, LookupExtractorFactory> lookups) throws Exception { final Map<String, LookupExtractorFactory> failedUpdates = new HashMap<>(); for (final String name : lookups.keySet()) { final LookupExtractorFactoryContainer factoryContainer = new LookupExtractorFactoryContainer( null, lookups.get(name) ); manager.add(name, factoryContainer); } return ImmutableMap.of("status", "accepted", LookupModule.FAILED_UPDATES_KEY, failedUpdates); } @Override public Object get(String id) { return manager.get(id); } @Override public LookupsState getAll() { return manager.getAllLookupsState(); } @Override public Object delete(String id) { manager.remove(id); return id; } } ); }

Target:
public LookupListeningResource( final @Json ObjectMapper jsonMapper, final @Smile ObjectMapper smileMapper, final LookupReferencesManager manager ) { super( jsonMapper, smileMapper, new AbstractListenerHandler<LookupExtractorFactory>(new TypeReference<LookupExtractorFactory>() { }) { @Override public Response handleUpdates( InputStream inputStream, ObjectMapper mapper ) { final LookupsState<LookupExtractorFactoryContainer> state; try { state = mapper.readValue(inputStream, LOOKUPS_STATE_TYPE_REFERENCE); } catch (final IOException ex) { LOG.debug(ex, "Bad request"); return Response.status(Response.Status.BAD_REQUEST).entity(ServletResourceUtils.sanitizeException(ex)).build(); } try { state.getToLoad().forEach(manager::add); state.getToDrop().forEach(manager::remove); return Response.status(Response.Status.ACCEPTED).entity(manager.getAllLookupsState()).build(); } catch (Exception e) { LOG.error(e, "Error handling request"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } } @Override public Object post(final Map<String, LookupExtractorFactory> lookups) throws Exception { final Map<String, LookupExtractorFactory> failedUpdates = new HashMap<>(); for (final String name : lookups.keySet()) { final LookupExtractorFactoryContainer factoryContainer = new LookupExtractorFactoryContainer( null, lookups.get(name) ); manager.add(name, factoryContainer); } return ImmutableMap.of("status", "accepted", LookupModule.FAILED_UPDATES_KEY, failedUpdates); } @Override public Object get(String id) { return manager.get(id); } @Override public LookupsState<LookupExtractorFactoryContainer> getAll() { return manager.getAllLookupsState(); } @Override public Object delete(String id) { manager.remove(id); return id; } } ); }