public static void compareExistingType(EventType newEventType, EventType existingType) throws ExprValidationException { ExprValidationException compared = ((EventTypeSPI) newEventType).equalsCompareType(existingType); if (compared != null) { throw new ExprValidationException("Event type named '" + newEventType.getName() + "' has already been declared with differing column name or type information: " + compared.getMessage(), compared); } }
public ExprValidationException equalsCompareType(EventType otherEventType) { if (this == otherEventType) { return null; } if (!(otherEventType instanceof WrapperEventType)) { return new ExprValidationException("Expected a wrapper event type but received " + otherEventType); } WrapperEventType other = (WrapperEventType) otherEventType; ExprValidationException underlyingMapCompare = other.underlyingMapType.equalsCompareType(this.underlyingMapType); if (underlyingMapCompare != null) { return underlyingMapCompare; } if (!(other.underlyingEventType instanceof EventTypeSPI) || (!(this.underlyingEventType instanceof EventTypeSPI))) { if (!other.underlyingEventType.equals(this.underlyingEventType)) { return new ExprValidationException("Wrapper underlying type mismatches"); } return null; } EventTypeSPI otherUnderlying = (EventTypeSPI) other.underlyingEventType; EventTypeSPI thisUnderlying = (EventTypeSPI) this.underlyingEventType; return otherUnderlying.equalsCompareType(thisUnderlying); }
boolean mismatch; if (setTwoType instanceof EventTypeSPI && setOneType instanceof EventTypeSPI) { ExprValidationException compared = ((EventTypeSPI) setOneType).equalsCompareType((EventTypeSPI) setTwoType); mismatch = compared != null; } else {