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

ru.d_shap.conditionalvalues.ConditionalValuesException Maven / Gradle / Ivy

Go to download

Conditional values simplify conditional logic and get rid of if-statements in the code

The newest version!
///////////////////////////////////////////////////////////////////////////////////////////////////
// Conditional values simplify conditional logic and get rid of if-statements in the code.
// Copyright (C) 2016 Dmitry Shapovalov.
//
// This file is part of conditional values.
//
// Conditional values is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Conditional values 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see .
///////////////////////////////////////////////////////////////////////////////////////////////////
package ru.d_shap.conditionalvalues;

/**
 * Base class for all exceptions.
 *
 * @author Dmitry Shapovalov
 */
public class ConditionalValuesException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    /**
     * Create a new object.
     *
     * @param message exception message.
     */
    protected ConditionalValuesException(final String message) {
        super(message);
    }

    /**
     * Create a new object.
     *
     * @param cause the original exception.
     */
    protected ConditionalValuesException(final Throwable cause) {
        super(getThrowableMessage(cause), cause);
    }

    /**
     * Create a new object.
     *
     * @param message exception message.
     * @param cause   the original exception.
     */
    protected ConditionalValuesException(final String message, final Throwable cause) {
        super(message, cause);
    }

    private static String getThrowableMessage(final Throwable throwable) {
        if (throwable == null) {
            return null;
        } else {
            return throwable.getMessage();
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy