OSDN Git Service

Merge "Implement (but @hide) java.text.Normalizer from Java 6."
[android-x86/dalvik.git] / libcore / xml / src / main / java / org / apache / xml / serializer / dom3 / DOMErrorImpl.java
1 /*\r
2  * Licensed to the Apache Software Foundation (ASF) under one\r
3  * or more contributor license agreements. See the NOTICE file\r
4  * distributed with this work for additional information\r
5  * regarding copyright ownership. The ASF licenses this file\r
6  * to you under the Apache License, Version 2.0 (the  "License");\r
7  * you may not use this file except in compliance with the License.\r
8  * You may obtain a copy of the License at\r
9  *\r
10  *     http://www.apache.org/licenses/LICENSE-2.0\r
11  *\r
12  * Unless required by applicable law or agreed to in writing, software\r
13  * distributed under the License is distributed on an "AS IS" BASIS,\r
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15  * See the License for the specific language governing permissions and\r
16  * limitations under the License.\r
17  */\r
18 /*\r
19  * $Id:  $\r
20  */\r
21 \r
22 package org.apache.xml.serializer.dom3;\r
23 \r
24 import org.w3c.dom.DOMError;\r
25 import org.w3c.dom.DOMLocator;\r
26 \r
27 /**\r
28  * Implementation of the DOM Level 3 DOMError interface.\r
29  *\r
30  * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ERROR-Interfaces-DOMError'>DOMError Interface definition from Document Object Model (DOM) Level 3 Core Specification</a>.\r
31  * \r
32  * @xsl.usage internal \r
33  */\r
34 \r
35 public final class DOMErrorImpl implements DOMError {\r
36     \r
37     /** private data members */\r
38     \r
39     // The DOMError Severity\r
40     private short fSeverity = DOMError.SEVERITY_WARNING;\r
41     \r
42     // The Error message\r
43     private String fMessage = null;\r
44     \r
45     //  A String indicating which related data is expected in relatedData. \r
46     private String fType;\r
47     \r
48     // The platform related exception\r
49     private Exception fException = null;\r
50     \r
51     //  \r
52     private Object fRelatedData;\r
53     \r
54     // The location of the exception\r
55     private DOMLocatorImpl fLocation = new DOMLocatorImpl();\r
56     \r
57     \r
58     //\r
59     // Constructors\r
60     //\r
61     \r
62     /** \r
63      * Default constructor. \r
64      */    \r
65     DOMErrorImpl () {\r
66     }\r
67     \r
68     /**\r
69      * @param severity\r
70      * @param message\r
71      * @param type\r
72      */\r
73     public DOMErrorImpl(short severity, String message, String type) {\r
74         fSeverity = severity;\r
75         fMessage = message;\r
76         fType = type;\r
77     }\r
78     \r
79     /**\r
80      * @param severity\r
81      * @param message\r
82      * @param type\r
83      * @param exception\r
84      */\r
85     public DOMErrorImpl(short severity, String message, String type,\r
86             Exception exception) {\r
87         fSeverity = severity;\r
88         fMessage = message;\r
89         fType = type;\r
90         fException = exception;\r
91     }\r
92     \r
93     /**\r
94      * @param severity\r
95      * @param message\r
96      * @param type\r
97      * @param exception\r
98      * @param relatedData\r
99      * @param location\r
100      */\r
101     public DOMErrorImpl(short severity, String message, String type,\r
102             Exception exception, Object relatedData, DOMLocatorImpl location) {\r
103         fSeverity = severity;\r
104         fMessage = message;\r
105         fType = type;\r
106         fException = exception;\r
107         fRelatedData = relatedData;\r
108         fLocation = location;\r
109     }\r
110     \r
111     \r
112     /**\r
113      * The severity of the error, either <code>SEVERITY_WARNING</code>, \r
114      * <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.\r
115      * \r
116      * @return A short containing the DOMError severity\r
117      */\r
118     public short getSeverity() {\r
119         return fSeverity;\r
120     }\r
121     \r
122     /**\r
123      * The DOMError message string.\r
124      * \r
125      * @return String\r
126      */\r
127     public String getMessage() {\r
128         return fMessage;\r
129     }\r
130     \r
131     /**\r
132      * The location of the DOMError.\r
133      * \r
134      * @return A DOMLocator object containing the DOMError location.\r
135      */\r
136     public DOMLocator getLocation() {\r
137         return fLocation;\r
138     }\r
139     \r
140     /**\r
141      * The related platform dependent exception if any.\r
142      * \r
143      * @return A java.lang.Exception \r
144      */\r
145     public Object getRelatedException(){\r
146         return fException;\r
147     }\r
148     \r
149     /**\r
150      * Returns a String indicating which related data is expected in relatedData.\r
151      * \r
152      * @return A String\r
153      */\r
154     public String getType(){\r
155         return fType;\r
156     }\r
157     \r
158     /**\r
159      * The related DOMError.type dependent data if any.\r
160      * \r
161      * @return java.lang.Object \r
162      */\r
163     public Object getRelatedData(){\r
164         return fRelatedData;\r
165     }\r
166     \r
167     public void reset(){\r
168         fSeverity = DOMError.SEVERITY_WARNING; \r
169         fException = null;\r
170         fMessage = null;\r
171         fType = null;\r
172         fRelatedData = null;\r
173         fLocation = null;        \r
174     }\r
175     \r
176 }// class DOMErrorImpl\r