@Test public void testMultipleGroupExtraction() { PropertiesCollectorSPI spi = getStringFileNameSpi(); PropertiesCollector collector = spi.create("regex=_([0-9]{8})T([0-9]{6})_", Arrays.asList("seq")); File file = new File("polyphemus_20130301T000000_.nc"); collector.collect(file); collector.setProperties(feature); String seq = (String) feature.getAttribute("seq"); assertNotNull(seq); assertEquals("20130301000000", seq); }
@Override public void setProperties(SimpleFeature feature) { List<String> matches = getMatches(); if (matches.size() <= 0) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("No matches found for this property extractor:"); } int index = 0; for (String propertyName : getPropertyNames()) { feature.setAttribute(propertyName, matches.get(index++)); if (index >= matches.size()) return; } }
StringFileNameExtractor extends RegExPropertiesCollector { @Override public void setProperties(SimpleFeature feature) { List<String> matches = getMatches(); if (matches.size() <= 0) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("No matches found for this property extractor:"); } int index = 0; for (String propertyName : getPropertyNames()) { feature.setAttribute(propertyName, matches.get(index++)); if (index >= matches.size()) return; } } }
StringFileNameExtractor extends RegExPropertiesCollector { @Override public void setProperties(SimpleFeature feature) { List<String> matches = getMatches(); if (matches.size() <= 0) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("No matches found for this property extractor:"); } int index = 0; for (String propertyName : getPropertyNames()) { feature.setAttribute(propertyName, matches.get(index++)); if (index >= matches.size()) return; } } StringFileNameExtractor(
            PropertiesCollectorSPI spi, List<String> propertyNames, String regex); }
StringFileNameExtractor extends RegExPropertiesCollector { @Override public void setProperties(SimpleFeature feature) { List<String> matches = getMatches(); if (matches.size() <= 0) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("No matches found for this property extractor:"); } int index = 0; for (String propertyName : getPropertyNames()) { feature.setAttribute(propertyName, matches.get(index++)); if (index >= matches.size()) return; } } StringFileNameExtractor(
            PropertiesCollectorSPI spi, List<String> propertyNames, String regex); @Override void setProperties(SimpleFeature feature); }
StringFileNameExtractor extends RegExPropertiesCollector { @Override public void setProperties(SimpleFeature feature) { List<String> matches = getMatches(); if (matches.size() <= 0) { if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("No matches found for this property extractor:"); } int index = 0; for (String propertyName : getPropertyNames()) { feature.setAttribute(propertyName, matches.get(index++)); if (index >= matches.size()) return; } } StringFileNameExtractor(
            PropertiesCollectorSPI spi, List<String> propertyNames, String regex); @Override void setProperties(SimpleFeature feature);  }