01: /* Licensed to the Apache Software Foundation (ASF) under one or more
02: * contributor license agreements. See the NOTICE file distributed with
03: * this work for additional information regarding copyright ownership.
04: * The ASF licenses this file to You under the Apache License, Version 2.0
05: * (the "License"); you may not use this file except in compliance with
06: * the License. You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package java.util;
18:
19: import java.io.Serializable;
20:
21: /**
22: * The unchecked exception will be thrown out if a conversion and flags are
23: * incompatible.
24: */
25: public class FormatFlagsConversionMismatchException extends
26: IllegalFormatException implements Serializable {
27:
28: private static final long serialVersionUID = 19120414L;
29:
30: private String f;
31:
32: private char c;
33:
34: /**
35: * Construct a FormatFlagsConversionMismatchException with the flags and
36: * conversion specified.
37: *
38: * @param f
39: * The flags
40: * @param c
41: * The conversion
42: */
43: public FormatFlagsConversionMismatchException(String f, char c) {
44: if (null == f) {
45: throw new NullPointerException();
46: }
47: this .f = f;
48: this .c = c;
49: }
50:
51: /**
52: * Returns the incompatible format flag.
53: *
54: * @return The incompatible format flag.
55: */
56: public String getFlags() {
57: return f;
58: }
59:
60: /**
61: * Returns the incompatible Conversion.
62: *
63: * @return The incompatible Conversion.
64: */
65: public char getConversion() {
66: return c;
67: }
68:
69: /**
70: * Returns the message string of the FormatFlagsConversionMismatchException.
71: *
72: * @return The message string of the FormatFlagsConversionMismatchException.
73: */
74: @Override
75: public String getMessage() {
76: StringBuilder buffer = new StringBuilder();
77: buffer.append("Mismatched Convertor =");
78: buffer.append(c);
79: buffer.append(", Flags= ");
80: buffer.append(f);
81: return buffer.toString();
82: }
83: }
|