Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ParameterException |
|
| 1.0;1 |
1 | 0 | /** 2007, Digitalis Informatica. All rights reserved. |
2 | * | |
3 | * Distribuicao e Gestao de Informatica, Lda. | |
4 | * Estrada de Paco de Arcos num.9 - Piso -1 | |
5 | * 2780-666 Paco de Arcos | |
6 | * Telefone: (351) 21 4408990 | |
7 | * Fax: (351) 21 4408999 | |
8 | * http://www.digitalis.pt | |
9 | */ | |
10 | package pt.digitalis.dif.exception.objects; | |
11 | ||
12 | import pt.digitalis.dif.controller.interfaces.IDIFContext; | |
13 | import pt.digitalis.dif.dem.interfaces.IStage; | |
14 | import pt.digitalis.dif.dem.objects.parameters.IParameter; | |
15 | import pt.digitalis.dif.exception.DIFException; | |
16 | ||
17 | /** | |
18 | * Exception for IParameter operations | |
19 | * | |
20 | * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a> | |
21 | */ | |
22 | public class ParameterException extends DIFException { | |
23 | ||
24 | /** Serial Version ID. */ | |
25 | private static final long serialVersionUID = -3450110830894378355L; | |
26 | ||
27 | /** The tag for 'parameter' annotations. */ | |
28 | final static private String PARAMETER = "PARAMETER"; | |
29 | ||
30 | /** The tag for 'parameter' annotations. */ | |
31 | final static private String CONTEXT = "CONTEXT"; | |
32 | ||
33 | /** The tag for 'parameter' annotations. */ | |
34 | final static private String STAGE = "STAGE"; | |
35 | ||
36 | /** | |
37 | * Constructor | |
38 | * | |
39 | * @param reason | |
40 | * the reason for the exception | |
41 | * @param parameter | |
42 | * the parameter that generated the exception | |
43 | */ | |
44 | public ParameterException(String reason, IParameter<?> parameter) { | |
45 | 0 | super(reason); |
46 | 0 | setParameter(parameter); |
47 | 0 | } |
48 | ||
49 | /** | |
50 | * Constructor | |
51 | * | |
52 | * @param reason | |
53 | * the reason for the exception | |
54 | * @param exception | |
55 | * the exception thrown | |
56 | * @param parameter | |
57 | * the parameter that generated the exception | |
58 | */ | |
59 | public ParameterException(String reason, Exception exception, IParameter<?> parameter) { | |
60 | 0 | super(reason, exception); |
61 | 0 | setParameter(parameter); |
62 | 0 | } |
63 | ||
64 | /** | |
65 | * @param parameter | |
66 | * the parameter to set | |
67 | */ | |
68 | public void setParameter(IParameter<?> parameter) { | |
69 | 0 | addToExceptionContext(PARAMETER, parameter); |
70 | 0 | } |
71 | ||
72 | /** | |
73 | * @param stage | |
74 | * the stage to set | |
75 | */ | |
76 | public void setStage(IStage stage) { | |
77 | 0 | addToExceptionContext(STAGE, stage); |
78 | 0 | } |
79 | ||
80 | /** | |
81 | * @param context | |
82 | * the stage to set | |
83 | */ | |
84 | public void setContext(IDIFContext context) { | |
85 | 0 | addToExceptionContext(CONTEXT, context); |
86 | 0 | } |
87 | } |