| FormatFlagsConversionMismatchException.java |
1 /*
2 * %W% %E%
3 *
4 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6 */
7
8 package java.util;
9
10 /**
11 * Unchecked exception thrown when a conversion and flag are incompatible.
12 *
13 * <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
14 * method or constructor in this class will cause a {@link
15 * NullPointerException} to be thrown.
16 *
17 * @version %I%, %G%
18 * @since 1.5
19 */
20 public class FormatFlagsConversionMismatchException
21 extends IllegalFormatException
22 {
23 private static final long serialVersionUID = 19120414L;
24
25 private String f;
26
27 private char c;
28
29 /**
30 * Constructs an instance of this class with the specified flag
31 * and conversion.
32 *
33 * @param f
34 * The flag
35 *
36 * @param c
37 * The conversion
38 */
39 public FormatFlagsConversionMismatchException(String f, char c) {
40 if (f == null)
41 throw new NullPointerException();
42 this.f = f;
43 this.c = c;
44 }
45
46 /**
47 * Returns the incompatible flag.
48 *
49 * @return The flag
50 */
51 public String getFlags() {
52 return f;
53 }
54
55 /**
56 * Returns the incompatible conversion.
57 *
58 * @return The conversion
59 */
60 public char getConversion() {
61 return c;
62 }
63
64 public String getMessage() {
65 return "Conversion = " + c + ", Flags = " + f;
66 }
67 }
68