package gdi1sokoban.exceptions;
/*============================================================================*/
/**
* Exception that is thrown whenever a method's parameter falls out of the scope
* of allowed values
*
* @author Steven Arzt, Oren Avni, Guido Roessling
* @version 1.0
*/
public class ParameterOutOfRangeException
extends Exception {
/* ======================================================================== */
private static final long serialVersionUID = 1L;
private String parameterName =
"";
/* ======================================================================== */
/**
* Creates a new instance of the ParameterOutOfRangeException class
*
* @param paramName
* The name of the parameter that has failed the validity check
*/
public ParameterOutOfRangeException
(final String paramName
) {
this(paramName, null);
}
/* ======================================================================== */
/**
* Creates a new instance of the ParameterOutOfRangeException class with the
* value that has caused the error
*
* @param paramName
* The name of the parameter that has failed the validity check
* @param aValue
* The value that has caused the error
*/
public ParameterOutOfRangeException
(final String paramName,
final Object aValue
) {
super ("The " + paramName + " parameter got an invalid value");
parameterName = paramName;
value = aValue;
}
/* ======================================================================== */
/**
* Creates a new instance of the ParameterOutOfRangeException class with an
* inner exception for exception chaining
*
* @param paramName
* The name of the parameter that has failed the validity check
* @param innerException
* The inner exception that has led to this one
*/
public ParameterOutOfRangeException
(final String paramName,
super(innerException);
parameterName = paramName;
}
/* ======================================================================== */
/**
* Gets the name of the parameter that has failed the validity check
*
* @return The name of the parameter that has failed the validity check
*/
public String getParameterName
() {
return parameterName;
}
/* ======================================================================== */
/**
* Gets the value that has caused the error
*
* @return The value that has caused the error
*/
return value;
}
/* ======================================================================== */
}
/* ============================================================================ */