1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 package com.unitesk.atp.dynattrs;
33
34 /***
35 * This exception reports about various problems with attribute:
36 * wrong name, type, acces violation etc.
37 * Exception provides information about object and attribute.
38 * A cause of exception contains additional information.
39 *
40 * @author <A href="mailto:demakov@ispras.ru">Alexey Demakov</A>
41 * @version $Id: AttributeException.java,v 1.1 2004/10/09 06:19:04 all-x Exp $
42 */
43 public class AttributeException extends RuntimeException
44 {
45 /***
46 * @param obj Attributed object.
47 * @param name Attribute name.
48 */
49 public AttributeException( Object obj, String name )
50 {
51 this( obj, name, null, null );
52 }
53
54 /***
55 * @param obj Attributed object.
56 * @param name Attribute name.
57 * @param value Attribute value.
58 */
59 public AttributeException( Object obj, String name, Object value )
60 {
61 this( obj, name, value, null );
62 }
63
64 /***
65 * @param obj Attributed object.
66 * @param name Attribute name.
67 * @param value Attribute value.
68 * @param cause Cause of this exception.
69 */
70 public AttributeException( Object obj, String name, Object value, Throwable cause )
71 {
72 super( cause );
73 this.obj = obj;
74 this.name = name;
75 this.value = value;
76 }
77
78 public String getMessage()
79 {
80 return "object: '" + obj
81 + "' name: '" + name
82 + "' value: '" + value
83 + "' cause: '" + getCause() + "'";
84 }
85
86 /***
87 * @return Attributed object.
88 */
89 public Object getObject()
90 {
91 return obj;
92 }
93
94 /***
95 * @return Attribute name.
96 */
97 public String getName()
98 {
99 return name;
100 }
101
102 /***
103 * @return Attribute value.
104 */
105 public Object getValue()
106 {
107 return value;
108 }
109
110 protected Object obj;
111 protected String name;
112 protected Object value;
113 }