SQLReportCodec implements SQLMapCodec<Path, Report> { @Override public Map<String, Object> encodeKey(final Object o) { final TikaDocument tikaDocument = (TikaDocument) o; final Map<String, Object> map = new HashMap<>(); if (null != idKey) { map.put(idKey, tikaDocument.getId()); } if (null != foreignIdKey) { map.put(foreignIdKey, tikaDocument.getForeignId()); } map.put(pathKey, tikaDocument.getPath().toString()); return map; } SQLReportCodec(final DocumentFactory factory, final Options<String> options);   SQLReportCodec(final DocumentFactory factory); @Override Map<String, Object> encodeKey(final Object o); @Override Path decodeKey(final ResultSet rs); @Override Map<String, Object> encodeValue(final Object o); @Override Report decodeValue(final ResultSet rs);  }
@Test public void testEncodeKey() throws Throwable { final SQLMapCodec<Path, Report> codec = new SQLReportCodec(documentFactory); final TikaDocument tikaDocument = documentFactory.create("a", "path/to/file"); final Map<String, Object> map = codec.encodeKey(tikaDocument); Assert.assertEquals("path/to/file", map.get("path")); }