private Map<String, AttributeExtractor> getCombinedExtractors(Map<String, AttributeExtractor> configExtractors, DynamicAttributesExtractor dynIndexer, Element element) { if (dynIndexer != null) { Map<String, AttributeExtractor> combinedExtractors = new HashMap<String, AttributeExtractor>(); combinedExtractors.putAll(configExtractors); Map<String, ?> dynamic = DynamicSearchChecker.getSearchAttributes(element, configExtractors.keySet(), dynIndexer); for (final Map.Entry<String, ?> entry: dynamic.entrySet()) { AttributeExtractor old = combinedExtractors.put(entry.getKey(), new AttributeExtractor() { @Override public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException { if (!attributeName.equals(entry.getKey())) { throw new AttributeExtractorException(String.format("Expected attribute name %s but got %s", entry.getKey(), attributeName)); } return entry.getValue(); } }); if (old != null) { throw new AttributeExtractorException(String.format("Attribute name %s already used by configured extractors", entry.getKey())); } } return combinedExtractors; } else { return configExtractors; } }
Map<String, ?> dynAttrs = DynamicSearchChecker.getSearchAttributes(element, extractors.keySet(), dynamicIndexer); Set<Attribute<?>> attrs = new HashSet<Attribute<?>>(dynAttrs.size());
private Map<String, AttributeExtractor> getCombinedExtractors(Map<String, AttributeExtractor> configExtractors, DynamicAttributesExtractor dynIndexer, Element element) { Map<String, AttributeExtractor> combinedExtractors = new HashMap<String, AttributeExtractor>(); combinedExtractors.putAll(configExtractors); if (dynIndexer != null) { Map<String, ?> dynamic = DynamicSearchChecker.getSearchAttributes(element, configExtractors.keySet(), dynIndexer); for (final Map.Entry<String, ?> entry: dynamic.entrySet()) { AttributeExtractor old = combinedExtractors.put(entry.getKey(), new AttributeExtractor() { @Override public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException { if (!attributeName.equals(entry.getKey())) { throw new AttributeExtractorException(String.format("Expected attribute name %s but got %s", entry.getKey(), attributeName)); } return entry.getValue(); } }); if (old != null) { throw new AttributeExtractorException(String.format("Attribute name %s already used by configured extractors", entry.getKey())); } } } return combinedExtractors; }
private Map<String, AttributeExtractor> getCombinedExtractors(Map<String, AttributeExtractor> configExtractors, DynamicAttributesExtractor dynIndexer, Element element) { if (dynIndexer != null) { Map<String, AttributeExtractor> combinedExtractors = new HashMap<String, AttributeExtractor>(); combinedExtractors.putAll(configExtractors); Map<String, ?> dynamic = DynamicSearchChecker.getSearchAttributes(element, configExtractors.keySet(), dynIndexer); for (final Map.Entry<String, ?> entry: dynamic.entrySet()) { AttributeExtractor old = combinedExtractors.put(entry.getKey(), new AttributeExtractor() { @Override public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException { if (!attributeName.equals(entry.getKey())) { throw new AttributeExtractorException(String.format("Expected attribute name %s but got %s", entry.getKey(), attributeName)); } return entry.getValue(); } }); if (old != null) { throw new AttributeExtractorException(String.format("Attribute name %s already used by configured extractors", entry.getKey())); } } return combinedExtractors; } else { return configExtractors; } }
Map<String, ?> dynAttrs = DynamicSearchChecker.getSearchAttributes(element, extractors.keySet(), dynamicIndexer); Set<Attribute<?>> attrs = new HashSet<Attribute<?>>(dynAttrs.size());
Map<String, ?> dynAttrs = DynamicSearchChecker.getSearchAttributes(element, extractors.keySet(), dynamicIndexer); Set<Attribute<?>> attrs = new HashSet<Attribute<?>>(dynAttrs.size());