All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.spraybot.messagerunner.ReportFrame Maven / Gradle / Ivy

Go to download

A micro-framework to allow easily passing specific Vert.x messages to specific addresses for processing of those messages.

The newest version!
package co.spraybot.messagerunner;

import co.spraybot.messagerunner.builders.ReportFrameBuilder;

import javax.annotation.Nullable;

/**
 * Represents a point on the ReportStream that is capable of providing either the data that is available at that point or
 * if the stream is finished the final summary for the report.
 *
 * @param  The type of data that this ReportFrame will return while the report is not finished
 */
public interface ReportFrame {

    /**
     * If this is true then getResult() will be null while getReportSummary() will return a value and vice versa.
     *
     * @return Whether the underlying stream for this ReportFrame will send anymore data
     */
    boolean isFinalFrame();

    /**
     * @return The data that is at the given cursor of the stream
     */
    @Nullable T getResult();

    /**
     * @return A final summary of all the data that was sent across the ReportStream.
     */
    @Nullable
    ReportSummary getReportSummary();

    /**
     *
     * @param  The type of data you expect to return from getResult in the constructed ReportFrame
     * @return A ReportFrameBuilder capable of building a ReportFrame that returns U as a result type
     */
    static  ReportFrameBuilder builder() {
        return new ReportFrameBuilder<>();
    }

}