KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > dna > tools > verifier > VerifyIssue


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.dna.tools.verifier;
9
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     /**
20      * Severity when issue is just a
21      * notice such as going against a
22      * convention.
23      */

24     public static final int NOTICE = 0;
25
26     /**
27      * Severity when issue is just a warning and
28      * not an error.
29      */

30     public static final int WARNING = 5;
31
32     /**
33      * Severity when issue is an error that
34      * will cause the component to fail to
35      * load.
36      */

37     public static final int ERROR = 10;
38
39     /**
40      * The severity of the issue.
41      */

42     private final int m_severity;
43
44     /**
45      * The message describing issue.
46      */

47     private final String JavaDoc m_description;
48
49     /**
50      * Create a new VerifyIssue.
51      *
52      * @param severity the serverity
53      * @param description the description
54      */

55     public VerifyIssue( final int severity,
56                         final String JavaDoc description )
57     {
58         if( null == description )
59         {
60             throw new NullPointerException JavaDoc( "description" );
61         }
62         m_severity = severity;
63         m_description = description;
64     }
65
66     /**
67      * Return true if issue is a warning.
68      *
69      * @return true if issue is a warning.
70      */

71     public boolean isWarning()
72     {
73         return WARNING == m_severity;
74     }
75
76     /**
77      * Return true if issue is an error.
78      *
79      * @return true if issue is an error.
80      */

81     public boolean isError()
82     {
83         return ERROR == m_severity;
84     }
85
86     /**
87      * Return a description of the issue.
88      *
89      * @return a description of the issue.
90      */

91     public String JavaDoc getDescription()
92     {
93         return m_description;
94     }
95 }
96
Popular Tags