01: /*
02: * Copyright (C) The Spice Group. All rights reserved.
03: *
04: * This software is published under the terms of the Spice
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.dna.tools.verifier;
09:
10: /**
11: * Class defining a problem discovered when verifying a
12: * DNA component type.
13: *
14: * @author Peter Donald
15: * @version $Revision: 1.1 $ $Date: 2004/04/18 20:13:45 $
16: */
17: public class VerifyIssue {
18: /**
19: * Severity when issue is just a
20: * notice such as going against a
21: * convention.
22: */
23: public static final int NOTICE = 0;
24:
25: /**
26: * Severity when issue is just a warning and
27: * not an error.
28: */
29: public static final int WARNING = 5;
30:
31: /**
32: * Severity when issue is an error that
33: * will cause the component to fail to
34: * load.
35: */
36: public static final int ERROR = 10;
37:
38: /**
39: * The severity of the issue.
40: */
41: private final int m_severity;
42:
43: /**
44: * The message describing issue.
45: */
46: private final String m_description;
47:
48: /**
49: * Create a new VerifyIssue.
50: *
51: * @param severity the serverity
52: * @param description the description
53: */
54: public VerifyIssue(final int severity, final String description) {
55: if (null == description) {
56: throw new NullPointerException("description");
57: }
58: m_severity = severity;
59: m_description = description;
60: }
61:
62: /**
63: * Return true if issue is a warning.
64: *
65: * @return true if issue is a warning.
66: */
67: public boolean isWarning() {
68: return WARNING == m_severity;
69: }
70:
71: /**
72: * Return true if issue is an error.
73: *
74: * @return true if issue is an error.
75: */
76: public boolean isError() {
77: return ERROR == m_severity;
78: }
79:
80: /**
81: * Return a description of the issue.
82: *
83: * @return a description of the issue.
84: */
85: public String getDescription() {
86: return m_description;
87: }
88: }
|