01: /*
02: * Copyright (C) 2007 Stephen Ostermiller
03: * http://ostermiller.org/contact.pl?regarding=Java+Utilities
04: *
05: * This program is free software; you can redistribute it and/or modify
06: * it under the terms of the GNU General Public License as published by
07: * the Free Software Foundation; either version 2 of the License, or
08: * (at your option) any later version.
09: *
10: * This program is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU General Public License for more details.
14: *
15: * See COPYING.TXT for details.
16: */
17: package com.Ostermiller.util;
18:
19: /**
20: * Exception thrown when a command line option that was unexpected is found.
21: */
22: public class UnknownCmdLnOptionException extends CmdLnException {
23:
24: /**
25: * serial version id
26: */
27: private static final long serialVersionUID = 6461128374875358108L;
28:
29: /**
30: * Constructs an <code>UnknownCmdLnOptionException</code>
31: */
32: public UnknownCmdLnOptionException() {
33: super ("Unknown command line option");
34: }
35:
36: private String argument;
37:
38: /**
39: * Get the argument that caused this exception
40: * @return the argument
41: */
42: public String getArgument() {
43: return argument;
44: }
45:
46: /**
47: * Set the argument
48: * @param argument the argument to set
49: * @return this for method chaining
50: */
51: UnknownCmdLnOptionException setArgument(String argument) {
52: this .argument = argument;
53: return this ;
54: }
55:
56: private String option;
57:
58: /**
59: * Get the option that caused this exception
60: * @return the option
61: */
62: public String getOption() {
63: return option;
64: }
65:
66: /**
67: * Set the option
68: * @param option the option to set
69: * @return this for method chaining
70: */
71: UnknownCmdLnOptionException setOption(String option) {
72: this .option = option;
73: return this ;
74: }
75:
76: @Override
77: public String getMessage() {
78: return super .getMessage() + ": " + getArgument() + ": "
79: + getOption();
80: }
81: }
|