@Test public void testValidXmlPersonMapping() throws Exception { xmlRecord = new XmlRecord(header, getXmlFromFile("/person.xml")); Record<Person> mappedRecord = xmlRecordMapper.processRecord(xmlRecord); Person person = mappedRecord.getPayload(); assertThat(person).isNotNull(); assertThat(person.getId()).isEqualTo(1); assertThat(person.getFirstName()).isEqualTo("foo"); assertThat(person.getLastName()).isEqualTo("bar"); assertThat(person.getBirthDate()).isEqualTo(new SimpleDateFormat("yyyy-MM-dd").parse("2000-01-01")); assertThat(person.isMarried()).isTrue(); }
@Override @SuppressWarnings(value = "unchecked") public Record<P> processRecord(final Record<String> record) throws Exception { P unmarshalledObject = (P) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(record.getPayload().getBytes())); return new GenericRecord<>(record.getHeader(), unmarshalledObject); }
XmlRecordMapper implements RecordMapper<String, P> { @Override @SuppressWarnings(value = "unchecked") public Record<P> processRecord(final Record<String> record) throws Exception { P unmarshalledObject = (P) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(record.getPayload().getBytes())); return new GenericRecord<>(record.getHeader(), unmarshalledObject); } }
XmlRecordMapper implements RecordMapper<String, P> { @Override @SuppressWarnings(value = "unchecked") public Record<P> processRecord(final Record<String> record) throws Exception { P unmarshalledObject = (P) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(record.getPayload().getBytes())); return new GenericRecord<>(record.getHeader(), unmarshalledObject); } XmlRecordMapper(final Class<P> type);  XmlRecordMapper(final Class<P> type, final Path xsd);  XmlRecordMapper(final Unmarshaller unmarshaller); }
XmlRecordMapper implements RecordMapper<String, P> { @Override @SuppressWarnings(value = "unchecked") public Record<P> processRecord(final Record<String> record) throws Exception { P unmarshalledObject = (P) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(record.getPayload().getBytes())); return new GenericRecord<>(record.getHeader(), unmarshalledObject); } XmlRecordMapper(final Class<P> type);  XmlRecordMapper(final Class<P> type, final Path xsd);  XmlRecordMapper(final Unmarshaller unmarshaller); @Override @SuppressWarnings(value = "unchecked") Record<P> processRecord(final Record<String> record); }
XmlRecordMapper implements RecordMapper<String, P> { @Override @SuppressWarnings(value = "unchecked") public Record<P> processRecord(final Record<String> record) throws Exception { P unmarshalledObject = (P) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(record.getPayload().getBytes())); return new GenericRecord<>(record.getHeader(), unmarshalledObject); } XmlRecordMapper(final Class<P> type);  XmlRecordMapper(final Class<P> type, final Path xsd);  XmlRecordMapper(final Unmarshaller unmarshaller); @Override @SuppressWarnings(value = "unchecked") Record<P> processRecord(final Record<String> record);  }