Source:
<code>protected void connectSensors(String mirroredEntityUrl) { Function<HttpToolResponse, Void> mirrorSensors = new Function<HttpToolResponse,Void>() { @SuppressWarnings("rawtypes") @Override public Void apply(HttpToolResponse input) { Map sensors = new Gson().fromJson(input.getContentAsString(), Map.class); for (Object kv: sensors.entrySet()) setAttribute(Sensors.newSensor(Object.class, ""+((Map.Entry)kv).getKey()), ((Map.Entry)kv).getValue()); setAttribute(MIRROR_STATUS, "normal"); return null; } }; @SuppressWarnings("rawtypes") Function<HttpToolResponse, Map> mirrorSummary = new Function<HttpToolResponse, Map>() { @Override <START> public Map apply(HttpToolResponse input) { <END> Map<?, ?> entitySummary = new Gson().fromJson(input.getContentAsString(), Map.class); String catalogItemId = (String)entitySummary.get("catalogItemId"); setAttribute(MIRROR_CATALOG_ITEM_ID, catalogItemId); return entitySummary; } }; final BrooklynEntityMirrorImpl self = this; mirror = HttpFeed.builder().entity(this) .baseUri(mirroredEntityUrl) .credentialsIfNotNull(getConfig(BrooklynNode.MANAGEMENT_USER), getConfig(BrooklynNode.MANAGEMENT_PASSWORD)) .period(getConfig(POLL_PERIOD)) .poll(HttpPollConfig.forMultiple() .suburl("/sensors/current-state") .onSuccess(mirrorSensors) .onFailureOrException(new Function<Object, Void>() { @Override public Void apply(Object input) { ServiceStateLogic.updateMapSensorEntry(self, Attributes.SERVICE_PROBLEMS, "mirror-feed", "error contacting service"); if (input instanceof HttpToolResponse) { int responseCode = ((HttpToolResponse)input).getResponseCode(); if (responseCode == HttpStatus.SC_NOT_FOUND) { Entities.unmanage(self); } } return null; } })) .poll(HttpPollConfig.forSensor(MIRROR_SUMMARY).onSuccess(mirrorSummary)).build(); populateEffectors(); }</code><technical_language>anonymous class</technical_language>

Target:
protected void connectSensors(String mirroredEntityUrl) { Function<HttpToolResponse, Void> mirrorSensors = new Function<HttpToolResponse,Void>() { @SuppressWarnings("rawtypes") @Override public Void apply(HttpToolResponse input) { Map sensors = new Gson().fromJson(input.getContentAsString(), Map.class); for (Object kv: sensors.entrySet()) setAttribute(Sensors.newSensor(Object.class, ""+((Map.Entry)kv).getKey()), ((Map.Entry)kv).getValue()); setAttribute(MIRROR_STATUS, "normal"); return null; } }; final BrooklynEntityMirrorImpl self = this; mirror = HttpFeed.builder().entity(this) .baseUri(mirroredEntityUrl) .credentialsIfNotNull(getConfig(BrooklynNode.MANAGEMENT_USER), getConfig(BrooklynNode.MANAGEMENT_PASSWORD)) .period(getConfig(POLL_PERIOD)) .poll(HttpPollConfig.forMultiple() .suburl("/sensors/current-state") .onSuccess(mirrorSensors) .onFailureOrException(new Function<Object, Void>() { @Override public Void apply(Object input) { ServiceStateLogic.updateMapSensorEntry(self, Attributes.SERVICE_PROBLEMS, "mirror-feed", "error contacting service"); if (input instanceof HttpToolResponse) { int responseCode = ((HttpToolResponse)input).getResponseCode(); if (responseCode == HttpStatus.SC_NOT_FOUND) { Entities.unmanage(self); } } return null; } })) .poll(HttpPollConfig.forSensor(MIRROR_SUMMARY).onSuccess(new MirrorSummary())).build(); populateEffectors(); }