@Test public void testWrite() { ModsDefinition mods = new ModsDefinition(); MonographUnit munit = new MonographUnit(); munit.setIdentifiers(Arrays.asList(new IdentifierItem("type", "IDENTIFIER"))); munit.setNumber("NUMBER"); munit.setNote("NOTE"); MonographUnitMapper instance = new MonographUnitMapper(); instance.map(mods, munit); String toXml = ModsUtils.toXml(mods, true); System.out.println(toXml); MonographUnit result = instance.map(ModsUtils.unmarshal(toXml, ModsDefinition.class)); assertNotNull(result); assertEquals(Arrays.asList(new IdentifierItem(0, "type", "IDENTIFIER")), result.getIdentifiers()); assertEquals("NUMBER", result.getNumber()); assertEquals("NOTE", result.getNote()); }
@Override public MonographUnit map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); MonographUnit result = new MonographUnit(); IdentifierMapper identifierMap = new IdentifierMapper(); result.setIdentifiers(identifierMap.map(mods)); StringPlusLanguage number = nlookup.getNumber(false); result.setNumber(number == null ? null : number.getValue()); Text note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }
MonographUnitMapper implements Mapper<MonographUnit> { @Override public MonographUnit map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); MonographUnit result = new MonographUnit(); IdentifierMapper identifierMap = new IdentifierMapper(); result.setIdentifiers(identifierMap.map(mods)); StringPlusLanguage number = nlookup.getNumber(false); result.setNumber(number == null ? null : number.getValue()); Text note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; } }
MonographUnitMapper implements Mapper<MonographUnit> { @Override public MonographUnit map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); MonographUnit result = new MonographUnit(); IdentifierMapper identifierMap = new IdentifierMapper(); result.setIdentifiers(identifierMap.map(mods)); StringPlusLanguage number = nlookup.getNumber(false); result.setNumber(number == null ? null : number.getValue()); Text note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }  }
MonographUnitMapper implements Mapper<MonographUnit> { @Override public MonographUnit map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); MonographUnit result = new MonographUnit(); IdentifierMapper identifierMap = new IdentifierMapper(); result.setIdentifiers(identifierMap.map(mods)); StringPlusLanguage number = nlookup.getNumber(false); result.setNumber(number == null ? null : number.getValue()); Text note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }  @Override MonographUnit map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, MonographUnit munit); }
MonographUnitMapper implements Mapper<MonographUnit> { @Override public MonographUnit map(ModsDefinition mods) { NodeLookup nlookup = new NodeLookup(mods); MonographUnit result = new MonographUnit(); IdentifierMapper identifierMap = new IdentifierMapper(); result.setIdentifiers(identifierMap.map(mods)); StringPlusLanguage number = nlookup.getNumber(false); result.setNumber(number == null ? null : number.getValue()); Text note = nlookup.getNote(false); result.setNote(note == null ? null : note.getValue()); return result; }  @Override MonographUnit map(ModsDefinition mods); @Override ModsDefinition map(ModsDefinition mods, MonographUnit munit);  }