|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ParameterException.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 | /** | |
| 2 | * JTRunner is free software; you can redistribute it and/or modify it under the | |
| 3 | * terms of the GNU General Public License as published by the Free Software | |
| 4 | * Foundation; either version 2, or (at your option) any later version. | |
| 5 | */ | |
| 6 | ||
| 7 | package jtr.assigner.util; | |
| 8 | ||
| 9 | /** | |
| 10 | * This exception is thrown when the JTR runtime is not able to properly set | |
| 11 | * a property of an <code>IRunner</code> instance. | |
| 12 | * | |
| 13 | * @author Francesco Russo (frusso@dev.java.net) | |
| 14 | * @since 4.0 | |
| 15 | * @version 3.1 | |
| 16 | */ | |
| 17 | public class ParameterException extends RuntimeException { | |
| 18 | ||
| 19 | /** | |
| 20 | * Creates a new instance of ParameterException | |
| 21 | * @param msg | |
| 22 | * @param bean | |
| 23 | * @param name | |
| 24 | * @param value | |
| 25 | */ | |
| 26 | 0 | public ParameterException(String msg, Object bean, String name, Object value) { |
| 27 | 0 | super(msg); |
| 28 | 0 | this.bean = bean; |
| 29 | 0 | this.name = name; |
| 30 | 0 | this.value = value; |
| 31 | } | |
| 32 | ||
| 33 | /** | |
| 34 | * Creates a new instance with a message and a cause. | |
| 35 | * @param msg | |
| 36 | * @param cause | |
| 37 | * @param bean | |
| 38 | * @param name | |
| 39 | * @param value | |
| 40 | */ | |
| 41 | 0 | public ParameterException(String msg, Throwable cause, Object bean, String name, Object value) { |
| 42 | 0 | super(msg,cause); |
| 43 | 0 | this.bean = bean; |
| 44 | 0 | this.name = name; |
| 45 | 0 | this.value = value; |
| 46 | } | |
| 47 | ||
| 48 | /** | |
| 49 | * Obtains the <code>IRunner</code> instance over which the parameter setting | |
| 50 | * has failed. | |
| 51 | * | |
| 52 | * @return Object | |
| 53 | */ | |
| 54 | 0 | public Object getBean() { |
| 55 | 0 | return bean; |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 | * Obtains the name of the property over which the parameter setting has failed. | |
| 60 | * @return String | |
| 61 | */ | |
| 62 | 0 | public String getName() { |
| 63 | 0 | return name; |
| 64 | } | |
| 65 | ||
| 66 | /** | |
| 67 | * Obtains the value that should have been set over the property. | |
| 68 | * @return Object | |
| 69 | */ | |
| 70 | 0 | public Object getValue() { |
| 71 | 0 | return value; |
| 72 | } | |
| 73 | ||
| 74 | 0 | public String toString() { |
| 75 | 0 | return getMessage()+"\nUnable to set property "+name+" with value "+value+" over instance "+bean+" due to the following cause (if available):\n"+getCause(); |
| 76 | } | |
| 77 | ||
| 78 | private Object bean; | |
| 79 | private String name; | |
| 80 | private Object value; | |
| 81 | } |
|
||||||||||