if (navigator.getName() != Element.USER_AGENT) {
throw unexpectedElement(navigator);
}
navigator.child();
UserAgentConditions userAgentConditions = new UserAgentConditions();
// contains
ArrayList<String> contains = null;
for (StaxNavigator<Element> fork : navigator.fork(Element.CONTAINS)) {
if (contains == null) {
contains = new ArrayList<String>();
}
contains.add(fork.getContent());
}
if (contains != null) {
userAgentConditions.setContains(contains);
}
// does-not-contain
ArrayList<String> doesNotContain = null;
for (StaxNavigator<Element> fork : navigator.fork(Element.DOES_NOT_CONTAIN)) {
if (doesNotContain == null) {
doesNotContain = new ArrayList<String>();
}
doesNotContain.add(fork.getContent());
}
if (doesNotContain != null) {
userAgentConditions.setDoesNotContain(doesNotContain);
}
return userAgentConditions;
}