/
AndHandler.java
31 lines (26 loc) · 1016 Bytes
/
AndHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.jboss.windup.config.parser.xml.when;
import static org.joox.JOOX.$;
import java.util.ArrayList;
import java.util.List;
import org.jboss.windup.config.parser.ElementHandler;
import org.jboss.windup.config.parser.NamespaceElementHandler;
import org.jboss.windup.config.parser.ParserContext;
import org.ocpsoft.rewrite.config.And;
import org.ocpsoft.rewrite.config.Condition;
import org.w3c.dom.Element;
@NamespaceElementHandler(elementName = "and", namespace = "http://windup.jboss.org/v1/xml")
public class AndHandler implements ElementHandler<And>
{
@Override
public And processElement(ParserContext handlerManager, Element element)
{
List<Condition> conditions = new ArrayList<>();
List<Element> children = $(element).children().get();
for (Element child : children)
{
Condition condition = handlerManager.processElement(child);
conditions.add(condition);
}
return And.all(conditions.toArray(new Condition[conditions.size()]));
}
}