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

io.swagger.report.MessageBuilder Maven / Gradle / Ivy

There is a newer version: 1.0.71
Show newest version
package io.swagger.report;


import java.util.ArrayList;
import java.util.List;

public class MessageBuilder {
    List messages = new ArrayList<>();
    Severity highestSeverity = Severity.OPTIONAL;

    public Severity getHighestSeverity() {
        return highestSeverity;
    }

    public void append(Message message) {
        messages.add(message);

        if (message.getSeverity().isMoreSevere(highestSeverity)) {
            highestSeverity = message.getSeverity();
        }
    }

    public String toString() {
        StringBuilder b = new StringBuilder();
        for (Message error : messages) {
            b.append(error.toString()).append("\n");
        }

        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy