@Test public void testFromJsonObject() throws Exception { NdkPageMapper mapper = new NdkPageMapper(); Context ctx = new Context("uuid:1"); Page page = new Page(); page.setIndex("1"); page.setNumber("[1]"); page.setType("normalPage"); page.setPhysicalDescription("note"); page.setIdentifiers(Arrays.asList(new IdentifierItem(null, "uuid", "1"))); ModsDefinition mods = mapper.toMods(page, ctx); assertNotNull(mods); Page result = mapper.toJsonObject(mods, ctx); assertNotNull(result); assertEquals(page.getIndex(), result.getIndex()); assertEquals(page.getNumber(), result.getNumber()); assertEquals(page.getType(), result.getType()); assertEquals(page.getPhysicalDescription(), result.getPhysicalDescription()); assertEquals(Arrays.asList(new IdentifierItem(null, "uuid", "1")), result.getIdentifiers()); }
@Override public ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx) throws IOException { Page page = jsMapper.readValue(json, Page.class); return toMods(page, ctx); }
NdkPageMapper extends NdkMapper { @Override public ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx) throws IOException { Page page = jsMapper.readValue(json, Page.class); return toMods(page, ctx); } }
NdkPageMapper extends NdkMapper { @Override public ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx) throws IOException { Page page = jsMapper.readValue(json, Page.class); return toMods(page, ctx); }  }
NdkPageMapper extends NdkMapper { @Override public ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx) throws IOException { Page page = jsMapper.readValue(json, Page.class); return toMods(page, ctx); }  static ResourceBundle getPageTypeLabels(Locale locale); static String getPageTypeLabel(String pageType, Locale locale); @Override void createMods(ModsDefinition mods, Context ctx); @Override Page toJsonObject(ModsDefinition mods, Context ctx); @Override ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx); ModsDefinition createPage(String pid, String pageIndex, String pageNumber, String pageType); ModsDefinition createPage(String pageIndex, String pageNumber, String pageType, Context ctx); ModsDefinition toMods(Page page, Context ctx); ModsDefinition toMods(Page page, ModsDefinition mods); }
NdkPageMapper extends NdkMapper { @Override public ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx) throws IOException { Page page = jsMapper.readValue(json, Page.class); return toMods(page, ctx); }  static ResourceBundle getPageTypeLabels(Locale locale); static String getPageTypeLabel(String pageType, Locale locale); @Override void createMods(ModsDefinition mods, Context ctx); @Override Page toJsonObject(ModsDefinition mods, Context ctx); @Override ModsDefinition fromJsonObject(ObjectMapper jsMapper, String json, Context ctx); ModsDefinition createPage(String pid, String pageIndex, String pageNumber, String pageType); ModsDefinition createPage(String pageIndex, String pageNumber, String pageType, Context ctx); ModsDefinition toMods(Page page, Context ctx); ModsDefinition toMods(Page page, ModsDefinition mods); static final String PAGE_TYPE_NORMAL; static final String RESOURCE_TYPE_TEXT; }