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

com.easyinnova.tiff.model.ValidationEvent Maven / Gradle / Ivy

There is a newer version: 1.9.7
Show newest version
/**
 * 

ValidationError.java

*

* This program is free software: you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version; or, at your choice, under the terms of the * Mozilla Public License, v. 2.0. SPDX GPL-3.0+ or MPL-2.0+. *

*

* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License and the Mozilla Public License for more details. *

*

* You should have received a copy of the GNU General Public License and the Mozilla Public License * along with this program. If not, see http://www.gnu.org/licenses/ and at http://mozilla.org/MPL/2.0 . *

*

* NB: for the © statement, include Easy Innova SL or other company/Person contributing the code. *

*

* © 2015 Easy Innova, SL *

* * @author Víctor Muñoz Solà * @version 1.0 * @since 18/5/2015 * */ package com.easyinnova.tiff.model; /** * The object that contains an error in the validation of a Tiff file. */ public class ValidationEvent { /** The error description. */ private String description; /** The value that has thrown the error. */ private String value; /** The error location (node). */ private String location; /** The level. */ private int level; /** * Default constructor. */ public ValidationEvent() { description = ""; value = null; level = 1; } /** * Parameterized constructor. * * @param desc error description * @param value the value that caused the error */ public ValidationEvent(String desc, String value) { this.description = desc; this.value = value; } /** * Parameterized constructor. * * @param desc error description * @param value the value that caused the error * @param loc the value location */ public ValidationEvent(String desc, String value, String loc) { this.description = desc; this.value = value; this.location = loc; } /** * Prints the error in the console. */ public void printError() { System.out.print(description); if (value != null) System.out.print(" (" + value + ")"); System.out.println(); } /** * Prints the warning in the console. */ public void printWarning() { System.out.print("Warning: "); System.out.print(description); if (value != null) System.out.print(" (" + value + ")"); System.out.println(); } /** * Gets the level. * * @return the level */ public int getLevel() { return level; } /** * Gets the location. * * @return the location */ public String getLocation() { if (location == null) return ""; return location; } /** * Gets the description. * * @return the description */ public String getDescription() { return description; } /** * Gets the erroneous value. * * @return the erroneous value */ public String getInvalidValue() { return value; } /** * Gets the string. * * @return the string */ @Override public String toString() { return description; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy