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

kz.greetgo.logging.structure.routing.AnalyzerResult Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
package kz.greetgo.logging.structure.routing;

import kz.greetgo.logging.structure.parser.model.ParseError;
import kz.greetgo.logging.structure.parser.model.ParseErrorList;
import lombok.RequiredArgsConstructor;

import java.util.List;

@RequiredArgsConstructor
public class AnalyzerResult {
  public final LogRouting routing;
  public final List errorList;

  public String errorContent() {
    if (errorList.isEmpty()) {
      return null;
    }
    StringBuilder sb = new StringBuilder();
    for (ParseError parseError : errorList) {
      sb.append('\n');
      sb.append(parseError.displayMessage()).append('\n');
    }
    return sb.toString();
  }

  public void throwIfErrorExists() {
    if (errorList.size() == 1) {
      throw errorList.get(0);
    }
    if (errorList.size() > 1) {
      throw new ParseErrorList(errorList);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy