Vector<String> targetValues = new Vector<String>();
MandatoryTargetPolicy mt = new MandatoryTargetPolicy();
MandatoryTargetPolicy.FeatureBinding mfb = new MandatoryTargetPolicy.FeatureBinding();
mt.setFeatureBinding(mfb);
List<Target> targets = mfb.getTargetBindings();
for(RequiredElements re : assertionList){
Iterator itr = re.getTargets();
while(itr.hasNext()){
String xpathExpr = (String)itr.next();
if(!targetValues.contains(xpathExpr)){
targetValues.add(xpathExpr);
Target tr = new Target();
tr.setType(Target.TARGET_TYPE_VALUE_XPATH);
tr.setValue(xpathExpr);
tr.setContentOnly(false);
tr.setEnforce(true);
targets.add(tr);
}
}
}
mp.append(mt);