@Test void unserialize() { Optional<MentionEventParams> actual = this.objectMapper.unserialize( "{\"userReference\":\"xwiki:XWiki.User\"," + "\"documentReference\":\"xwiki:XWiki.Doc\"," + "\"location\":\"COMMENT\"," + "\"anchor\":\"myAnchor\"}"); assertTrue(actual.isPresent()); MentionEventParams expected = new MentionEventParams() .setDocumentReference("xwiki:XWiki.Doc") .setUserReference("xwiki:XWiki.User") .setLocation(MentionLocation.COMMENT) .setAnchor("myAnchor"); assertEquals(expected, actual.get()); }
@Override public Optional<MentionEventParams> unserialize(String data) { try { MentionEventParams mentionEventParams = this.objectMapper.readValue(new StringReader(data), MentionEventParams.class); return Optional.of(mentionEventParams); } catch (IOException e) { this.logger.warn("Failed to parse [{}]. Cause [{}].", data, getRootCauseMessage(e)); return Optional.empty(); } }
DefaultMentionsNotificationsObjectMapper implements MentionsNotificationsObjectMapper, Initializable { @Override public Optional<MentionEventParams> unserialize(String data) { try { MentionEventParams mentionEventParams = this.objectMapper.readValue(new StringReader(data), MentionEventParams.class); return Optional.of(mentionEventParams); } catch (IOException e) { this.logger.warn("Failed to parse [{}]. Cause [{}].", data, getRootCauseMessage(e)); return Optional.empty(); } } }
DefaultMentionsNotificationsObjectMapper implements MentionsNotificationsObjectMapper, Initializable { @Override public Optional<MentionEventParams> unserialize(String data) { try { MentionEventParams mentionEventParams = this.objectMapper.readValue(new StringReader(data), MentionEventParams.class); return Optional.of(mentionEventParams); } catch (IOException e) { this.logger.warn("Failed to parse [{}]. Cause [{}].", data, getRootCauseMessage(e)); return Optional.empty(); } }  }
DefaultMentionsNotificationsObjectMapper implements MentionsNotificationsObjectMapper, Initializable { @Override public Optional<MentionEventParams> unserialize(String data) { try { MentionEventParams mentionEventParams = this.objectMapper.readValue(new StringReader(data), MentionEventParams.class); return Optional.of(mentionEventParams); } catch (IOException e) { this.logger.warn("Failed to parse [{}]. Cause [{}].", data, getRootCauseMessage(e)); return Optional.empty(); } }  @Override Optional<MentionEventParams> unserialize(String data); @Override Optional<String> serialize(MentionEventParams params); @Override void initialize(); }
DefaultMentionsNotificationsObjectMapper implements MentionsNotificationsObjectMapper, Initializable { @Override public Optional<MentionEventParams> unserialize(String data) { try { MentionEventParams mentionEventParams = this.objectMapper.readValue(new StringReader(data), MentionEventParams.class); return Optional.of(mentionEventParams); } catch (IOException e) { this.logger.warn("Failed to parse [{}]. Cause [{}].", data, getRootCauseMessage(e)); return Optional.empty(); } }  @Override Optional<MentionEventParams> unserialize(String data); @Override Optional<String> serialize(MentionEventParams params); @Override void initialize();  }