KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > retest > util > ComparisonResultSet


1 package xdoclet.retest.util;
2
3 import xdoclet.util.Translator;
4 import xdoclet.XDocletException;
5 import xdoclet.retest.XDocletRetestMessages;
6
7 import java.util.List JavaDoc;
8 import java.util.ArrayList JavaDoc;
9 import java.util.Iterator JavaDoc;
10
11 /**
12  * @author Vincent Harcq (vincent.harcq@hubmethods.com)
13  * @created Mars 5, 2002
14  * @version $Revision: 1.3 $
15  */

16 public class ComparisonResultSet
17 {
18     protected List JavaDoc messages;
19
20     public ComparisonResultSet()
21     {
22         messages = new ArrayList JavaDoc();
23     }
24
25     public String JavaDoc[] getMessages()
26     {
27         return (String JavaDoc[])messages.toArray(new String JavaDoc[messages.size()]);
28     }
29
30     public void addError(String JavaDoc message, String JavaDoc[] params)
31     throws XDocletException
32     {
33         messages.add(Translator.getString(XDocletRetestMessages.class, message, params));
34     }
35
36     public boolean error()
37     {
38         return messages.size() > 0;
39     }
40
41     public String JavaDoc toString()
42     {
43         String JavaDoc ret="";
44         if (messages.size() > 0)
45         {
46             ret = ret + "==== " + messages.size() + " error(s) ====\n";
47             Iterator JavaDoc it = messages.iterator();
48             while (it.hasNext())
49             {
50                 ret = ret + "========== " + (String JavaDoc)it.next() + "\n";
51             }
52         }
53         return ret;
54     }
55
56
57 }
58
Popular Tags