001/*
002 * Copyright 2012-2017 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.diagnostics;
018
019/**
020 * The result of analyzing a failure.
021 *
022 * @author Andy Wilkinson
023 * @since 1.4.0
024 */
025public class FailureAnalysis {
026
027        private final String description;
028
029        private final String action;
030
031        private final Throwable cause;
032
033        /**
034         * Creates a new {@code FailureAnalysis} with the given {@code description} and
035         * {@code action}, if any, that the user should take to address the problem. The
036         * failure had the given underlying {@code cause}.
037         * @param description the description
038         * @param action the action
039         * @param cause the cause
040         */
041        public FailureAnalysis(String description, String action, Throwable cause) {
042                this.description = description;
043                this.action = action;
044                this.cause = cause;
045        }
046
047        /**
048         * Returns a description of the failure.
049         * @return the description
050         */
051        public String getDescription() {
052                return this.description;
053        }
054
055        /**
056         * Returns the action, if any, to be taken to address the failure.
057         * @return the action or {@code null}
058         */
059        public String getAction() {
060                return this.action;
061        }
062
063        /**
064         * Returns the cause of the failure.
065         * @return the cause
066         */
067        public Throwable getCause() {
068                return this.cause;
069        }
070
071}