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

net.sf.jsqlparser.util.validation.ValidationException Maven / Gradle / Ivy

Go to download

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern.

There is a newer version: 5.1
Show newest version
/*-
 * #%L
 * JSQLParser library
 * %%
 * Copyright (C) 2004 - 2020 JSQLParser
 * %%
 * Dual licensed under GNU LGPL 2.1 or Apache License 2.0
 * #L%
 */
package net.sf.jsqlparser.util.validation;

import java.util.Objects;

public class ValidationException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    public ValidationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ValidationException(String message) {
        super(message);
    }

    public ValidationException(Throwable cause) {
        super(cause == null ? null : cause.getMessage(), cause);
    }

    @Override
    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }
        if (this == o) {
            return true;
        }

        if (o.getClass().equals(this.getClass())) {
            // exact type match!
            ValidationException ve = (ValidationException) o;
            return Objects.equals(getMessage(), ve.getMessage()) && Objects.equals(getCause(), ve.getCause());
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return getMessage().hashCode() + (getCause() == null ? 0 : getCause().toString().hashCode());
    }

    @Override
    public String toString () {
        return getClass().getSimpleName() + ": " + getMessage();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy