private static void validateSourceMapperCompatibility(StreamDefinition streamDefinition, String sourceType,
                                                          String mapType, Source source, SourceMapper sourceMapper,
                                                          Annotation sourceAnnotation) {
        Class[] inputEventClasses = sourceMapper.getSupportedInputEventClasses();
        Class[] outputEventClasses = source.getOutputEventClasses();

        //skipping validation for unknown output types
        if (outputEventClasses == null || outputEventClasses.length == 0) {
            return;
        }

        boolean matchingSinkAndMapperClasses = false;
        for (Class inputEventClass : inputEventClasses) {
            for (Class outputEventClass : outputEventClasses) {
                if (inputEventClass.isAssignableFrom(outputEventClass)) {
                    matchingSinkAndMapperClasses = true;
                    break;
                }
            }
            if (matchingSinkAndMapperClasses) {
                break;
            }
        }
        if (!matchingSinkAndMapperClasses) {
            throw new SiddhiAppCreationException("At stream '" + streamDefinition.getId() + "', source '" + sourceType
                    + "' produces incompatible '" + Arrays.deepToString(outputEventClasses) +
                    "' classes, while it's source mapper '" + mapType + "' can only consume '" +
                    Arrays.deepToString(inputEventClasses) + "' classes.",
                    sourceAnnotation.getQueryContextStartIndex(), sourceAnnotation.getQueryContextEndIndex());
        }
    }
Utility class for queryParser to help with QueryRuntime
generation.
modules/siddhi-core/src/main/java/io/siddhi/core/util/parser/helper/DefinitionParserHelper.java