/** * For JSON and XML serialization only. */ @JsonProperty("fields") private Map<String, Object> getOtherFields() { final Map<String, Object> otherFields; // If a caching controller is used, concurrent threads can operate on the same // instance of the Document class, so we need to synchronize here to avoid // ConcurrentModificationExceptions. synchronized (this) { otherFields = Maps.newHashMap(fields); } otherFields.remove(TITLE); otherFields.remove(SUMMARY); otherFields.remove(CONTENT_URL); otherFields.remove(SOURCES); otherFields.remove(LANGUAGE); otherFields.remove(SCORE); fireSerializationListeners(otherFields); return otherFields.isEmpty() ? null : otherFields; }
@ElementMap(entry = "field", key = "key", attribute = true, inline = true, required = false) private HashMap<String, SimpleXmlWrapperValue> getOtherFieldsXml() { final HashMap<String, SimpleXmlWrapperValue> otherFieldsForSerialization; synchronized (this) { otherFieldsForSerialization = MapUtils.asHashMap(SimpleXmlWrappers .wrap(fields)); } otherFieldsForSerialization.remove(TITLE); otherFieldsForSerialization.remove(SUMMARY); otherFieldsForSerialization.remove(CONTENT_URL); otherFieldsForSerialization.remove(SOURCES); otherFieldsForSerialization.remove(LANGUAGE); otherFieldsForSerialization.remove(SCORE); fireSerializationListeners(otherFieldsForSerialization); return otherFieldsForSerialization.isEmpty() ? null : otherFieldsForSerialization; }