* @see OptimizePartsConfig
*/
public class OptimizePartsBuilder implements AssertionBuilder<OMElement> {
public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
OptimizePartsConfig assertion = new OptimizePartsConfig();
OMElement expressionsElem = element.getFirstChildWithName(new QName(RampartConfig.NS, OptimizePartsConfig.EXPRESSIONS_LN));
if(expressionsElem != null){
Iterator iterator = expressionsElem.getChildElements();
while(iterator.hasNext()){
OMElement elem = (OMElement)iterator.next();
String expression = elem.getText();
assertion.addExpression(expression);
}
}
OMElement nsElem = element.getFirstChildWithName(new QName(RampartConfig.NS, OptimizePartsConfig.NAMESPACES_LN));
if(nsElem != null){
Iterator iterator = nsElem.getChildElements();
while(iterator.hasNext()){
OMElement elem = (OMElement)iterator.next();
String namespace = elem.getText();
String prefix = elem.getAttributeValue(new QName("", OptimizePartsConfig.PREFIX_ATTR));
String uri = elem.getAttributeValue(new QName("", OptimizePartsConfig.URI_ATTR));
assertion.addNamespaces(prefix, uri);
}
}
return assertion;
}