@Test public void testDval() throws Exception { ETLStatistics etlStatistics = new ETLStatistics(); Double dval = 0.0; CrsMultiMediaTransformer crsMultiMediaTransformer = new CrsMultiMediaTransformer(etlStatistics); CrsExtractor extractor = new CrsExtractor(multimediaFile, etlStatistics); for (XMLRecordInfo extracted : extractor) { CommonReflectionUtil.setField(AbstractTransformer.class, crsMultiMediaTransformer, "objectID", "RMNH.INS.867435"); CommonReflectionUtil.setField(AbstractTransformer.class, crsMultiMediaTransformer, "input", extracted); Element oaiDcElem = getDescendant(extracted.getRecord(), "oai_dc:dc"); List<Element> ncrsGatheringSites = getDescendants(oaiDcElem, "ncrsGatheringSites"); Element element = ncrsGatheringSites.get(0); Object obj = ReflectionUtil.call(crsMultiMediaTransformer, "dval", new Class[] {Element.class, String.class}, new Object[] {element, "dwc:decimalLongitude"}); dval = (Double) obj; } Double expectedDouble = 14.3405556; assertNotNull("01", dval); assertEquals("02", expectedDouble, dval); }
private Double dval(Element e, String tag) { String s = val(e, tag); if (s == null) return null; try { return Double.valueOf(s); } catch (NumberFormatException exc) { if (!suppressErrors) warn("Invalid number in element <%s>: \"%s\"", tag, s); return null; } }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private Double dval(Element e, String tag) { String s = val(e, tag); if (s == null) return null; try { return Double.valueOf(s); } catch (NumberFormatException exc) { if (!suppressErrors) warn("Invalid number in element <%s>: \"%s\"", tag, s); return null; } } }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private Double dval(Element e, String tag) { String s = val(e, tag); if (s == null) return null; try { return Double.valueOf(s); } catch (NumberFormatException exc) { if (!suppressErrors) warn("Invalid number in element <%s>: \"%s\"", tag, s); return null; } } CrsMultiMediaTransformer(ETLStatistics stats); }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private Double dval(Element e, String tag) { String s = val(e, tag); if (s == null) return null; try { return Double.valueOf(s); } catch (NumberFormatException exc) { if (!suppressErrors) warn("Invalid number in element <%s>: \"%s\"", tag, s); return null; } } CrsMultiMediaTransformer(ETLStatistics stats);  }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private Double dval(Element e, String tag) { String s = val(e, tag); if (s == null) return null; try { return Double.valueOf(s); } catch (NumberFormatException exc) { if (!suppressErrors) warn("Invalid number in element <%s>: \"%s\"", tag, s); return null; } } CrsMultiMediaTransformer(ETLStatistics stats);   }