package com.timgroup.eventsubscription;

import com.lmax.disruptor.EventFactory;
import com.lmax.disruptor.EventTranslator;
import com.timgroup.eventstore.api.ResolvedEvent;

public class EventContainer<T> {
    ResolvedEvent event = null;
    T deserializedEvent = null;

    public static class Factory<T> implements EventFactory<EventContainer<T>> {
        @Override
        public EventContainer<T> newInstance() {
            return new EventContainer<>();
        }
    }

    public static class Translator<T> implements EventTranslator<EventContainer<T>> {
        private ResolvedEvent currentEvent;

        public Translator<T> setting(ResolvedEvent event) {
            currentEvent = event;
            return this;
        }

        @Override
        public void translateTo(EventContainer<T> eventContainer, long sequence) {
            eventContainer.event = currentEvent;
        }
    }
}

@@ -899,11 +899,215 @@
  %7D%0A    %7D
+%0A%0A    @Override%0A    public String toString() %7B%0A        return %22EventContainer%7B%22 +%0A                %22event=%22 + event +%0A                %22, deserializedEvent=%22 + deserializedEvent +%0A                '%7D';%0A    %7D
 %0A%7D%0A

implement toString in EventContainer