| IllegalFormatPrecisionException.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 the precision is a negative value other than
12 * <tt>-1</tt>, the conversion does not support a precision, or the value is
13 * otherwise unsupported.
14 *
15 * @version %I%, %G%
16 * @since 1.5
17 */
18 public class IllegalFormatPrecisionException extends IllegalFormatException {
19
20 private static final long serialVersionUID = 18711008L;
21
22 private int p;
23
24 /**
25 * Constructs an instance of this class with the specified precision.
26 *
27 * @param p
28 * The precision
29 */
30 public IllegalFormatPrecisionException(int p) {
31 this.p = p;
32 }
33
34 /**
35 * Returns the precision
36 *
37 * @return The precision
38 */
39 public int getPrecision() {
40 return p;
41 }
42
43 public String getMessage() {
44 return Integer.toString(p);
45 }
46 }
47