01: /*
02: Copyright 2004-2007 Paul R. Holser, Jr. All rights reserved.
03: Licensed under the Academic Free License version 3.0
04: */
05:
06: package joptsimple;
07:
08: /**
09: * Thrown when a problem occurs converting a string argument into another type.
10: *
11: * @since 2.0
12: * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
13: * @version $Id: OptionArgumentConversionException.java,v 1.8 2007/04/10 20:06:25 pholser Exp $
14: */
15: class OptionArgumentConversionException extends OptionException {
16: private static final long serialVersionUID = -1L;
17:
18: private final String argument;
19: private final Class valueType;
20:
21: OptionArgumentConversionException(String option, String argument,
22: Class valueType) {
23: super (option);
24:
25: this .argument = argument;
26: this .valueType = valueType;
27: }
28:
29: /**
30: * {@inheritDoc}
31: */
32: public String getMessage() {
33: return "cannot convert argument '" + argument + "' of option '"
34: + option() + "' to " + valueType;
35: }
36: }
|