public void convertData(long timestamp, Object[] data, StreamEvent.Type type, StreamEvent newEvent) {
        for (ConversionMapping conversionMapping : conversionMappings) {
            int[] position = conversionMapping.getToPosition();
            int fromPosition = conversionMapping.getFromPosition();
            switch (position[0]) {
                case 0:
                    newEvent.setBeforeWindowData(data[fromPosition], position[1]);
                    break;
                case 1:
                    newEvent.setOnAfterWindowData(data[fromPosition], position[1]);
                    break;
                case 2:
                    newEvent.setOutputData(data[fromPosition], position[1]);
                    break;
                default:
                    //can not happen
            }
        }

        newEvent.setType(type);
        newEvent.setTimestamp(timestamp);
    }
The converter class that converts the events into StreamEvent
modules/siddhi-core/src/main/java/io/siddhi/core/event/stream/converter/SelectiveStreamEventConverter.java