class EventInformationBuilder {

    public EventInformation build(long timestamp, String componentName, String streamId, Set<String> targetComponents,
                                  StreamlineEvent event) {
        String sourceComponentName = EventCorrelationInjector.getSourceComponentName(event);
        if (!componentName.equals(sourceComponentName)) {
            throw new IllegalStateException("component name in event correlation is different from provided component name");
        }
        return new EventInformation(timestamp, componentName, streamId, targetComponents, event.getId(),
                EventCorrelationInjector.getRootIds(event), EventCorrelationInjector.getParentIds(event),
                event);
    }

}