001 /* 002 * Copyright 2003-2004 The Apache Software Foundation. 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 017 package org.apache.commons.mapper; 018 019 /** 020 * MapperException encapsulates everything that could go wrong with mappers. 021 * Often this will wrap another type of exception such as SQLException so that 022 * callers are insulated from implementation specific exceptions. Callers can check 023 * the getCause() method for the wrapped exception. 024 */ 025 public class MapperException extends Exception { 026 027 private Throwable cause = null; 028 029 /** 030 * Constructor for MapperException. 031 */ 032 public MapperException() { 033 super(); 034 } 035 036 /** 037 * Constructor for MapperException. 038 * @param message 039 */ 040 public MapperException(String message) { 041 super(message); 042 } 043 044 /** 045 * Constructor for MapperException. 046 * @param message 047 * @param cause 048 */ 049 public MapperException(String message, Throwable cause) { 050 super(message); 051 052 this.cause = cause; 053 } 054 055 /** 056 * Constructor for MapperException. 057 * @param cause 058 */ 059 public MapperException(Throwable cause) { 060 this.cause = cause; 061 } 062 063 /** 064 * Returns the cause. 065 * @return Throwable 066 */ 067 public Throwable getCause() { 068 return this.cause; 069 } 070 071 }