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

co.spraybot.messagerunner.builders.ReportFrameBuilder 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.builders;

import co.spraybot.messagerunner.ReportFrame;
import co.spraybot.messagerunner.ReportSummary;

import javax.annotation.Nullable;

public class ReportFrameBuilder {

    private T data;
    private ReportSummary summary;

    public ReportFrameBuilder frameData(T data) {
        this.data = data;
        return this;
    }

    public ReportFrameBuilder finalSummary(ReportSummary reportSummary) {
        summary = reportSummary;
        return this;
    }

    public ReportFrame build() {
        ReportFrame frame = new ReportFrame() {
            private T result;
            private ReportSummary summary;

            private ReportFrame init(T result, ReportSummary summary) {
                this.result = result;
                this.summary = summary;
                return this;
            }

            @Override
            public boolean isFinalFrame() {
                return summary != null;
            }

            @Nullable
            @Override
            public T getResult() {
                return result;
            }

            @Nullable
            @Override
            public ReportSummary getReportSummary() {
                return summary;
            }
        }.init(data, summary);

        return frame;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy