1 /*
2 * Copyright (C) The Spice Group. All rights reserved.
3 *
4 * This software is published under the terms of the Spice
5 * Software License version 1.1, a copy of which has been included
6 * with this distribution in the LICENSE.txt file.
7 */
8 package org.codehaus.spice.configkit;
9
10 import org.xml.sax.SAXParseException;
11
12 /***
13 * This class records a specific issue that occured during validation.
14 *
15 * @author Peter Donald
16 * @author <a href="mailto:proyal at apache.org">Peter Royal</a>
17 * @version $Revision: 1.1 $ $Date: 2003/12/03 03:19:28 $
18 */
19 public class ValidationIssue
20 {
21 /*** Type code for WARNING issues. */
22 static final int TYPE_WARNING = 1;
23
24 /*** Type code for ERROR issues. */
25 static final int TYPE_ERROR = 2;
26
27 /*** Type code for FATAL_ERROR issues. */
28 static final int TYPE_FATAL_ERROR = 3;
29
30 /*** The type of the issue (one of TYPE_* constants). */
31 private final int m_type;
32
33 /*** The exception that caused issue. */
34 private final SAXParseException m_exception;
35
36 /***
37 * Create an issue with specified type and exception that caused issue.
38 *
39 * @param type the type of issue
40 * @param exception the exception that caused issue.
41 */
42 public ValidationIssue( final int type,
43 final SAXParseException exception )
44 {
45 if( null == exception )
46 {
47 throw new NullPointerException( "exception" );
48 }
49 m_type = type;
50 m_exception = exception;
51 }
52
53 /***
54 * Return true if the issue is a warning, false otherwise.
55 *
56 * @return true if the issue is a warning, false otherwise.
57 */
58 public boolean isWarning()
59 {
60 return TYPE_WARNING == m_type;
61 }
62
63 /***
64 * Return true if the issue is an error, false otherwise.
65 *
66 * @return true if the issue is an error, false otherwise.
67 */
68 public boolean isError()
69 {
70 return TYPE_ERROR == m_type;
71 }
72
73 /***
74 * Return true if the issue is a fatal error, false otherwise.
75 *
76 * @return true if the issue is a fatal error, false otherwise.
77 */
78 public boolean isFatalError()
79 {
80 return TYPE_FATAL_ERROR == m_type;
81 }
82
83 /***
84 * The exception that caused issue.
85 *
86 * @return the exception that caused issue.
87 */
88 public SAXParseException getException()
89 {
90 return m_exception;
91 }
92 }
This page was automatically generated by Maven