01: package org.objectweb.celtix.tools.common.toolspec.parser;
02:
03: import java.util.*;
04:
05: public class BadUsageException extends Exception {
06: public static final long serialVersionUID = 1L;
07: private final String usage;
08: private final ErrorVisitor errors;
09:
10: public BadUsageException() {
11: this ("(unknown)", null);
12: }
13:
14: public BadUsageException(ErrorVisitor err) {
15: this ("(unknown)", err);
16: }
17:
18: public BadUsageException(String use, ErrorVisitor err) {
19: super ("Usage: " + use);
20: this .usage = use;
21: this .errors = err;
22: }
23:
24: public Collection getErrors() {
25: return errors.getErrors();
26: }
27:
28: public String getMessage() {
29: StringBuffer sb = new StringBuffer();
30:
31: if (errors != null) {
32: sb.append(errors.toString());
33: }
34: return sb.toString();
35: }
36:
37: public String getUsage() {
38: return usage;
39: }
40:
41: }
|