/** * Find the {@link ReportFormat} for a given name. * * @param format * name of the report format * @return matching enum value */ public static ReportFormat parse(final String format) { for (final ReportFormat value : ReportFormat.values()) { if (value.toString().equals(format)) { return value; } } final String availableValues = Arrays.stream(values()) // .map(ReportFormat::toString) // .map(s -> '"' + s + '"') // .collect(joining(", ")); throw new IllegalArgumentException( "Unknown report format \"" + format + "\". Supported formats: " + availableValues); } }
protected Reportable createReport(final Trace trace, final ReportSettings settings) { Reportable report = null; final String format = settings.getOutputFormat(); switch (ReportFormat.parse(format)) { case PLAIN_TEXT: report = new PlainTextReport(trace, settings); break; case HTML: report = new HtmlReport(trace); break; default: throw new IllegalArgumentException( "Unable to create report with format \"" + format + "\""); } return report; }
protected Reportable createReport(final Trace trace, final ReportSettings settings) { Reportable report = null; final String format = settings.getOutputFormat(); switch (ReportFormat.parse(format)) { case PLAIN_TEXT: report = new PlainTextReport(trace, settings); break; case HTML: report = new HtmlReport(trace); break; default: throw new IllegalArgumentException( "Unable to create report with format \"" + format + "\""); } return report; }
/** * Find the {@link ReportFormat} for a given name. * * @param format * name of the report format * @return matching enum value */ public static ReportFormat parse(final String format) { for (final ReportFormat value : ReportFormat.values()) { if (value.toString().equals(format)) { return value; } } final String availableValues = Arrays.stream(values()) // .map(ReportFormat::toString) // .map(s -> '"' + s + '"') // .collect(joining(", ")); throw new IllegalArgumentException( "Unknown report format \"" + format + "\". Supported formats: " + availableValues); } }