001 //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/datatypes/parameter/InvalidParameterValueException.java $ 002 /*---------------------------------------------------------------------------- 003 This file is part of deegree, http://deegree.org/ 004 Copyright (C) 2001-2009 by: 005 Department of Geography, University of Bonn 006 and 007 lat/lon GmbH 008 009 This library is free software; you can redistribute it and/or modify it under 010 the terms of the GNU Lesser General Public License as published by the Free 011 Software Foundation; either version 2.1 of the License, or (at your option) 012 any later version. 013 This library is distributed in the hope that it will be useful, but WITHOUT 014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 016 details. 017 You should have received a copy of the GNU Lesser General Public License 018 along with this library; if not, write to the Free Software Foundation, Inc., 019 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 020 021 Contact information: 022 023 lat/lon GmbH 024 Aennchenstr. 19, 53177 Bonn 025 Germany 026 http://lat-lon.de/ 027 028 Department of Geography, University of Bonn 029 Prof. Dr. Klaus Greve 030 Postfach 1147, 53001 Bonn 031 Germany 032 http://www.geographie.uni-bonn.de/deegree/ 033 034 e-mail: info@deegree.org 035 ----------------------------------------------------------------------------*/ 036 package org.deegree.datatypes.parameter; 037 038 /** 039 * Thrown when a parameter with an invalid value was encountered. 040 * 041 * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a> 042 * @author last edited by: $Author: mschneider $ 043 * 044 * @version $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $ 045 */ 046 public class InvalidParameterValueException extends IllegalArgumentException { 047 048 private static final long serialVersionUID = 470707628607887728L; 049 050 private final String parameterName; 051 052 private final Object value; 053 054 /** 055 * Creates an exception with the specified invalid value. 056 * 057 * @param message 058 * The detail message. The detail message is saved for later retrieval by the 059 * {@link #getMessage()} method. 060 * @param parameterName 061 * The parameter name. 062 * @param value 063 * The invalid parameter value. 064 */ 065 public InvalidParameterValueException( String message, String parameterName, Object value ) { 066 super( message ); 067 this.parameterName = parameterName; 068 this.value = value; 069 } 070 071 /** 072 * Creates an exception with the specified invalid value as a floating point. 073 * 074 * @param message 075 * The detail message. The detail message is saved for later retrieval by the 076 * {@link #getMessage()} method. 077 * @param parameterName 078 * The parameter name. 079 * @param value 080 * The invalid parameter value. 081 */ 082 public InvalidParameterValueException( String message, String parameterName, double value ) { 083 this( message, parameterName, new Double( value ) ); 084 } 085 086 /** 087 * Creates an exception with the specified invalid value as an integer. 088 * 089 * @param message 090 * The detail message. The detail message is saved for later retrieval by the 091 * {@link #getMessage()} method. 092 * @param parameterName 093 * The parameter name. 094 * @param value 095 * The invalid parameter value. 096 */ 097 public InvalidParameterValueException( String message, String parameterName, int value ) { 098 this( message, parameterName, new Integer( value ) ); 099 } 100 101 /** 102 * Returns the parameter name. 103 * 104 * @return the parameter name. 105 */ 106 public String getParameterName() { 107 return parameterName; 108 } 109 110 /** 111 * Returns the invalid parameter value. 112 * 113 * @return the invalid parameter value. 114 */ 115 public Object getValue() { 116 return value; 117 } 118 }