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

org.yangcentral.yangkit.parser.YangParserException Maven / Gradle / Ivy

There is a newer version: 1.4.5
Show newest version
package org.yangcentral.yangkit.parser;

import org.yangcentral.yangkit.base.Position;
import org.yangcentral.yangkit.common.api.exception.Severity;

public class YangParserException extends Exception {
   private static final long serialVersionUID = 1L;
   private Severity severity;
   private String description;
   private Position position;

   public YangParserException(Severity severity, Position position, String description) {
      this.severity = severity;
      this.position = position;
      this.description = description;
   }

   public Severity getSeverity() {
      return this.severity;
   }

   public String getDescription() {
      return this.description;
   }

   public Position getPosition() {
      return this.position;
   }

   public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("@" + this.position.toString());
      switch (this.severity) {
         case ERROR:
            sb.append("Error:");
            break;
         case WARNING:
            sb.append("Warning:");
            break;
         case INFO:
            sb.append("Info:");
            break;
         case DEBUG:
            sb.append("Debug:");
            break;
         default:
            return null;
      }

      if (null != this.description) {
         sb.append(" ");
         sb.append(this.description);
      }

      return sb.toString();
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy