Operator op, String val) {
Assert.isNotNull(op, "op"); //$NON-NLS-1$
Assert.isNotNull(fld, "fld"); //$NON-NLS-1$
switch (op.getId()) {
case Operators.ID_OP_CONTAINS:
return new StringRestriction(fld, Operators.OPERATOR_CONTAINS, val);
case Operators.ID_OP_NOT_CONTAINS:
return new StringRestriction(fld, Operators.OPERATOR_NOT_CONTAINS, val);
case Operators.ID_OP_EQUALS:
return new StringRestriction(fld, Operators.OPERATOR_EQUALS, val);
case Operators.ID_OP_NOT_EQUALS:
return new StringRestriction(fld, Operators.OPERATOR_NOT_EQUALS, val);
case Operators.ID_OP_BEGINS_WITH:
return new StringRestriction(fld, Operators.OPERATOR_BEGINS_WITH, val);
case Operators.ID_OP_NOT_BEGINS_WITH:
return new StringRestriction(fld, Operators.OPERATOR_NOT_BEGINS_WITH, val);
}
Assert.isTrue(false, "Unsupported operator: " + op.getLabel()); //$NON-NLS-1$
return null;
}