}
protected ResourceBody createResourceBody(boolean additive, Expression titleExpr, Object... keyValPairs) {
ResourceBody rb = pf.createResourceBody();
rb.setNameExpr(titleExpr);
AttributeOperations aos = pf.createAttributeOperations();
EList<AttributeOperation> aoList = aos.getAttributes();
for(int i = 0; i < keyValPairs.length; i++) {
AttributeOperation ao = pf.createAttributeOperation();
ao.setOp(additive
? "+>"
: "=>");
if(!(keyValPairs[i] instanceof String))
throw new IllegalArgumentException("Bad test spec, key not a String");
ao.setKey((String) (keyValPairs[i++]));
if(keyValPairs[i] instanceof String) {
SingleQuotedString valueExpr = pf.createSingleQuotedString();
valueExpr.setText((String) (keyValPairs[i]));
ao.setValue(valueExpr);
}
else if(keyValPairs[i] instanceof Expression)
ao.setValue((Expression) keyValPairs[i]);
else
throw new IllegalArgumentException("Bad test spec, keyValPair value neither String not expression");
aoList.add(ao);
}
if(aos.getAttributes().size() > 0)
rb.setAttributes(aos);
return rb;
}