1 package com.github.mygreen.supercsv.cellprocessor.format;
2
3
4
5
6
7
8
9
10 public class TextParseException extends RuntimeException {
11
12
13 private static final long serialVersionUID = 7389770363413465673L;
14
15
16
17
18 private final String targetText;
19
20
21
22
23 private final Class<?> toType;
24
25 public TextParseException(final String targetText, final Class<?> toType) {
26 this(targetText, toType, String.format("fail parse from '%s' to type '%s'", targetText, toType.getCanonicalName()));
27 }
28
29 public TextParseException(final String targetText, final Class<?> toType, final String message) {
30 super(message);
31 this.targetText = targetText;
32 this.toType = toType;
33 }
34
35 public TextParseException(final String targetText, final Class<?> toType, final Throwable exception) {
36 super(exception);
37 this.targetText = targetText;
38 this.toType = toType;
39 }
40
41 public TextParseException(final String targetText, final Class<?> toType, final String message, final Throwable exception) {
42 super(message, exception);
43 this.targetText = targetText;
44 this.toType = toType;
45 }
46
47
48
49
50
51 public String getTargetText() {
52 return targetText;
53 }
54
55
56
57
58
59 public Class<?> getToType() {
60 return toType;
61 }
62
63 }