001/* 002 * ModeShape (http://www.modeshape.org) 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 */ 016package org.modeshape.schematic.internal.schema; 017 018import org.modeshape.schematic.SchemaLibrary; 019import org.modeshape.schematic.document.Path; 020 021public class ValidationProblem implements SchemaLibrary.Problem { 022 private final SchemaLibrary.ProblemType type; 023 private final Path path; 024 private final String reason; 025 private final Throwable cause; 026 027 public ValidationProblem( SchemaLibrary.ProblemType type, 028 Path path, 029 String reason, 030 Throwable cause ) { 031 this.type = type; 032 this.path = path; 033 this.reason = reason; 034 this.cause = cause; 035 } 036 037 @Override 038 public SchemaLibrary.ProblemType getType() { 039 return type; 040 } 041 042 @Override 043 public Path getPath() { 044 return path; 045 } 046 047 @Override 048 public String getReason() { 049 return reason; 050 } 051 052 @Override 053 public Throwable getCause() { 054 return cause; 055 } 056 057 @Override 058 public String toString() { 059 return "" + type + " at " + path + ": " + reason; 060 } 061}