use of org.jboss.weld.metadata.WeldFilterImpl in project core by weld.
the class BeansXmlStreamParser method handleFilter.
private void handleFilter(StartElement filterElement, XMLEventReader reader, Consumer<XmlMetadata<Filter>> consumer) throws XMLStreamException {
String name = getAttribute(filterElement, NAME_ATTRIBUTE_NAME);
String pattern = name != null ? null : getAttribute(filterElement, PATTERN_ATTRIBUTE_NAME);
if (name != null || pattern != null) {
List<Metadata<SystemPropertyActivation>> systemPropertyActivations = new LinkedList<>();
List<Metadata<ClassAvailableActivation>> classAvailableActivations = new LinkedList<>();
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
if (isEnd(event, EXCLUDE, SCANNING_URIS) || isEnd(event, INCLUDE, SCANNING_URIS)) {
Filter filter;
if (filterElement.getName().getNamespaceURI().equals(WELD_URI)) {
filter = new WeldFilterImpl(name, systemPropertyActivations, classAvailableActivations, pattern);
} else {
filter = new FilterImpl(name, systemPropertyActivations, classAvailableActivations);
}
consumer.accept(new XmlMetadata<Filter>(filterElement.getName().toString(), filter, beansXml, filterElement.getLocation().getLineNumber()));
return;
} else if (event.isStartElement()) {
StartElement element = (StartElement) event;
if (isStartElement(element, IF_CLASS_AVAILABLE, SCANNING_URIS)) {
classAvailable(element, classAvailableActivations::add, false);
} else if (isStartElement(element, IF_CLASS_NOT_AVAILABLE, SCANNING_URIS)) {
classAvailable(element, classAvailableActivations::add, true);
} else if (isStartElement(element, IF_SYSTEM_PROPERTY, SCANNING_URIS)) {
systemProperty(element, systemPropertyActivations::add);
}
}
}
}
}
Aggregations