package org.zoxweb.server.flow;


import java.util.EventObject;
import java.util.function.Supplier;


@SuppressWarnings("serial")
public class FlowEvent<T>
    extends EventObject
    implements Supplier<FlowEvent<T>>
{
    private long timestamp;
    protected T flowType;
    private long sequence;


    public FlowEvent(T type)
    {
        this(type, type);
    }


    public FlowEvent(Object source, T type)
    {
        super(source);
        this.flowType = type;
        this.timestamp = System.currentTimeMillis();
    }

    public T getFlowType()
    {
        return flowType;
    }

    public long getTimestamp()
    {
        return timestamp;
    }

    protected void setSequence(long sequence)
    {
        this.sequence = sequence;
    }
    public long getSequence()
    {
        return sequence;
    }

    public FlowEvent<T> get()
    {
        return this;
    }

}

{'avg_line_length': 16.0, 'max_line_length': 52, 'alphanum_fraction': 0.6060267857142857, 'licenses': ['Apache-2.0'], 'repository_name': 'fidusio/zoxweb-core', 'path': 'src/main/java/org/zoxweb/server/flow/FlowEvent.java', 'size': 896, 'lang': 'Java'}