if (!(eventType instanceof EventTypeSPI))
{
throw new ExprValidationException("Update statements require the event type to implement the " + EventTypeSPI.class + " interface");
}
EventTypeSPI eventTypeSPI = (EventTypeSPI) eventType;
TypeWidener[] wideners = new TypeWidener[desc.getAssignments().size()];
List<String> properties = new ArrayList<String>();
for (int i = 0; i < desc.getAssignments().size(); i++)
{
OnTriggerSetAssignment xxx = desc.getAssignments().get(i);
Pair<String, ExprNode> assignmentPair = ExprNodeUtility.checkGetAssignmentToProp(xxx.getExpression());
if (assignmentPair == null) {
throw new ExprValidationException("Missing property assignment expression in assignment number " + i);
}
EventPropertyDescriptor writableProperty = eventTypeSPI.getWritableProperty(assignmentPair.getFirst());
if (writableProperty == null)
{
throw new ExprValidationException("Property '" + assignmentPair.getFirst() + "' is not available for write access");
}
wideners[i] = TypeWidenerFactory.getCheckPropertyAssignType(assignmentPair.getSecond().toExpressionString(), assignmentPair.getSecond().getExprEvaluator().getType(),
writableProperty.getPropertyType(), assignmentPair.getFirst());
properties.add(assignmentPair.getFirst());
}
// check copy-able
EventBeanCopyMethod copyMethod = eventTypeSPI.getCopyMethod(properties.toArray(new String[properties.size()]));
if (copyMethod == null)
{
throw new ExprValidationException("The update-clause requires the underlying event representation to support copy (via Serializable by default)");
}