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

com.adobe.epubcheck.messages.Severity Maven / Gradle / Ivy

Go to download

EPUBCheck is a tool to validate the conformance of EPUB publications against the EPUB specifications. EPUBCheck can be run as a standalone command-line tool or used as a Java library.

There is a newer version: 4.1.1
Show newest version
package com.adobe.epubcheck.messages;

import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

public enum Severity
{
  SUPPRESSED("SUPPRESSED"),
  USAGE("USAGE"),
  INFO("INFO"),
  WARNING("WARNING"),
  ERROR("ERROR"),
  FATAL("FATAL");

  private final String name;

  Severity(String feature)
  {
    this.name = feature;
  }

  public String toString()
  {
    return name;
  }

  private static final Map map = new HashMap();

  static
  {
    for (Severity type : Severity.values())
    {
      map.put(type.name, type);
    }
  }

  public static Severity fromString(String name)
  {
    if (map.containsKey(name))
    {
      return map.get(name);
    }
    throw new NoSuchElementException(name + " not found");
  }

  public int toInt()
  {
    if (this.equals(SUPPRESSED)) return 0;
    if (this.equals(USAGE)) return 1;
    if (this.equals(INFO)) return 2;
    if (this.equals(WARNING)) return 3;
    if (this.equals(ERROR)) return 4;
    if (this.equals(FATAL)) return 5;
    return -1;
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy